mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Add default formatters for Au and Range
This commit is contained in:
parent
8010493089
commit
e7e7eab905
2 changed files with 14 additions and 0 deletions
|
@ -7,6 +7,7 @@ use geom::rect::Rect;
|
|||
use geom::size::Size2D;
|
||||
|
||||
use std::num::{NumCast, One, Zero};
|
||||
use std::fmt;
|
||||
|
||||
pub struct Au(i32);
|
||||
|
||||
|
@ -18,6 +19,12 @@ impl Clone for Au {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Default for Au {
|
||||
fn fmt(obj: &Au, f: &mut fmt::Formatter) {
|
||||
write!(f.buf, "Au({})", *obj);
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for Au {
|
||||
#[inline]
|
||||
fn eq(&self, other: &Au) -> bool {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
use std::cmp::{max, min};
|
||||
use std::iter;
|
||||
use std::fmt;
|
||||
|
||||
enum RangeRelation {
|
||||
OverlapsBegin(/* overlap */ uint),
|
||||
|
@ -21,6 +22,12 @@ pub struct Range {
|
|||
priv len: uint
|
||||
}
|
||||
|
||||
impl fmt::Default for Range {
|
||||
fn fmt(obj: &Range, f: &mut fmt::Formatter) {
|
||||
write!(f.buf, "[{} .. {})", obj.begin(), obj.end());
|
||||
}
|
||||
}
|
||||
|
||||
impl Range {
|
||||
#[inline]
|
||||
pub fn new(off: uint, len: uint) -> Range {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue