Replace usages of fmt! with format!
This commit is contained in:
parent
977aed60b0
commit
ff3522a711
4 changed files with 19 additions and 16 deletions
|
@ -15,11 +15,11 @@
|
|||
|
||||
//! Angle units for type-safe, self-documenting code.
|
||||
|
||||
pub use std::num::{cast, zero};
|
||||
pub use std::num::{sinh, cosh, tanh};
|
||||
pub use std::num::{asinh, acosh, atanh};
|
||||
|
||||
use std::num::Zero;
|
||||
use std::fmt;
|
||||
use std::num::{Zero, zero, cast};
|
||||
|
||||
#[deriving(Clone, Eq, Ord, Zero)] pub struct Rad<S> { s: S }
|
||||
#[deriving(Clone, Eq, Ord, Zero)] pub struct Deg<S> { s: S }
|
||||
|
@ -180,8 +180,8 @@ impl<S: Float> 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> ToStr for Rad<S> { fn to_str(&self) -> ~str { fmt!("%? rad", self.s) } }
|
||||
impl<S: Float> ToStr for Deg<S> { fn to_str(&self) -> ~str { fmt!("%?°", self.s) } }
|
||||
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> ApproxEq<S> for Rad<S> {
|
||||
#[inline]
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
//! disinguishes them from vectors, which have a length and direction, but do
|
||||
//! not have a fixed position.
|
||||
|
||||
use std::fmt;
|
||||
use std::num::zero;
|
||||
|
||||
use array::*;
|
||||
|
@ -88,14 +89,14 @@ 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> ToStr for Point2<S> {
|
||||
impl<S: fmt::Default> ToStr for Point2<S> {
|
||||
fn to_str(&self) -> ~str {
|
||||
fmt!("[%?, %?]", self.x, self.y)
|
||||
format!("[{}, {}]", self.x, self.y)
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> ToStr for Point3<S> {
|
||||
impl<S: fmt::Default> ToStr for Point3<S> {
|
||||
fn to_str(&self) -> ~str {
|
||||
fmt!("[%?, %?, %?]", self.x, self.y, self.z)
|
||||
format!("[{}, {}, {}]", self.x, self.y, self.z)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::fmt;
|
||||
use std::num::{zero, one, cast, sqrt};
|
||||
|
||||
use angle::{Angle, Rad, acos, cos, sin, sin_cos};
|
||||
|
@ -296,8 +297,8 @@ impl<S: Float> Neg<Quat<S>> for Quat<S> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<S> ToStr for Quat<S> {
|
||||
impl<S: fmt::Default> ToStr for Quat<S> {
|
||||
fn to_str(&self) -> ~str {
|
||||
fmt!("%? + %?i + %?j + %?k", self.s, self.v.x, self.v.y, self.v.z)
|
||||
format!("{} + {}i + {}j + {}k", self.s, self.v.x, self.v.y, self.v.z)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::fmt;
|
||||
use std::num::{Zero, zero, One, one, sqrt};
|
||||
|
||||
use angle::{Rad, atan2, acos};
|
||||
|
@ -282,20 +283,20 @@ impl<S: Float> EuclideanVector<S, [S, ..4]> for Vec4<S> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<S> ToStr for Vec2<S> {
|
||||
impl<S: fmt::Default> ToStr for Vec2<S> {
|
||||
fn to_str(&self) -> ~str {
|
||||
fmt!("[%?, %?]", self.x, self.y)
|
||||
format!("[{}, {}]", self.x, self.y)
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> ToStr for Vec3<S> {
|
||||
impl<S: fmt::Default> ToStr for Vec3<S> {
|
||||
fn to_str(&self) -> ~str {
|
||||
fmt!("[%?, %?, %?]", self.x, self.y, self.z)
|
||||
format!("[{}, {}, {}]", self.x, self.y, self.z)
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> ToStr for Vec4<S> {
|
||||
impl<S: fmt::Default> ToStr for Vec4<S> {
|
||||
fn to_str(&self) -> ~str {
|
||||
fmt!("[%?, %?, %?, %?]", self.x, self.y, self.z, self.w)
|
||||
format!("[{}, {}, {}, {}]", self.x, self.y, self.z, self.w)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue