diff options
-rw-r--r-- | src/components/util/geometry.rs | 7 | ||||
-rw-r--r-- | src/components/util/range.rs | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/components/util/geometry.rs b/src/components/util/geometry.rs index febb33660f4..ed0dcd5c420 100644 --- a/src/components/util/geometry.rs +++ b/src/components/util/geometry.rs @@ -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 { diff --git a/src/components/util/range.rs b/src/components/util/range.rs index e52dbae02ab..e52c3758003 100644 --- a/src/components/util/range.rs +++ b/src/components/util/range.rs @@ -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 { |