Merge pull request #41 from rlane/fmt-show

replace fmt::Default with fmt::Show
This commit is contained in:
Brendan Zabarauskas 2014-02-04 03:41:03 -08:00
commit 304151d2f7
5 changed files with 9 additions and 9 deletions

View file

@ -204,8 +204,8 @@ Angle<S> for Deg<S> {
#[inline] pub fn atan<S: Float>(s: S) -> Rad<S> { rad(s.atan()) }
#[inline] pub fn atan2<S: Float>(a: S, b: S) -> Rad<S> { rad(a.atan2(&b)) }
impl<S: Float + fmt::Default> ToStr for Rad<S> { fn to_str(&self) -> ~str { format!("{} rad", self.s) } }
impl<S: Float + fmt::Default> ToStr for Deg<S> { fn to_str(&self) -> ~str { format!("{}°", self.s) } }
impl<S: Float + fmt::Show> ToStr for Rad<S> { fn to_str(&self) -> ~str { format!("{} rad", self.s) } }
impl<S: Float + fmt::Show> ToStr for Deg<S> { fn to_str(&self) -> ~str { format!("{}°", self.s) } }
impl<S: Float + ApproxEq<S>>
ApproxEq<S> for Rad<S> {

View file

@ -99,13 +99,13 @@ array!(impl<S> Point3<S> -> [S, ..3] _3)
impl<S: Primitive> Point<S, Vec2<S>, [S, ..2]> for Point2<S> {}
impl<S: Primitive> Point<S, Vec3<S>, [S, ..3]> for Point3<S> {}
impl<S: fmt::Default> ToStr for Point2<S> {
impl<S: fmt::Show> ToStr for Point2<S> {
fn to_str(&self) -> ~str {
format!("[{}, {}]", self.x, self.y)
}
}
impl<S: fmt::Default> ToStr for Point3<S> {
impl<S: fmt::Show> ToStr for Point3<S> {
fn to_str(&self) -> ~str {
format!("[{}, {}, {}]", self.x, self.y, self.z)
}

View file

@ -280,7 +280,7 @@ Neg<Quat<S>> for Quat<S> {
}
}
impl<S: fmt::Default> ToStr for Quat<S> {
impl<S: fmt::Show> ToStr for Quat<S> {
fn to_str(&self) -> ~str {
format!("{} + {}i + {}j + {}k", self.s, self.v.x, self.v.y, self.v.z)
}

View file

@ -157,7 +157,7 @@ ToMat4<S> for Decomposed<S, Vec3<S>, R> {
impl<S: Float + ApproxEq<S>, R: Rotation3<S>>
Transform3<S> for Decomposed<S,Vec3<S>,R> {}
impl<S: fmt::Default + Float, R: ToStr + Rotation3<S>>
impl<S: fmt::Show + Float, R: ToStr + Rotation3<S>>
ToStr for Decomposed<S,Vec3<S>,R> {
fn to_str(&self) -> ~str {
format!("(scale({}), rot({:s}), disp{:s})",

View file

@ -301,19 +301,19 @@ EuclideanVector<S, [S, ..4]> for Vec4<S> {
}
}
impl<S: fmt::Default> ToStr for Vec2<S> {
impl<S: fmt::Show> ToStr for Vec2<S> {
fn to_str(&self) -> ~str {
format!("[{}, {}]", self.x, self.y)
}
}
impl<S: fmt::Default> ToStr for Vec3<S> {
impl<S: fmt::Show> ToStr for Vec3<S> {
fn to_str(&self) -> ~str {
format!("[{}, {}, {}]", self.x, self.y, self.z)
}
}
impl<S: fmt::Default> ToStr for Vec4<S> {
impl<S: fmt::Show> ToStr for Vec4<S> {
fn to_str(&self) -> ~str {
format!("[{}, {}, {}, {}]", self.x, self.y, self.z, self.w)
}