diff --git a/src/angle.rs b/src/angle.rs index 6aa45a0..053f349 100644 --- a/src/angle.rs +++ b/src/angle.rs @@ -34,6 +34,7 @@ use num::BaseFloat; #[repr(C, packed)] #[derive(Copy, Clone, PartialEq, PartialOrd, RustcEncodable, RustcDecodable)] pub struct Rad { pub s: S } + /// An angle, in degrees. /// /// This type is marked as `#[repr(C, packed)]`. @@ -77,9 +78,6 @@ pub trait Angle where { type Unitless: BaseFloat; - /// Create an angle from a unitless value. - fn new(value: Self::Unitless) -> Self; - /// Return the angle, normalized to the range `[0, full_turn)`. #[inline] fn normalize(self) -> Self { @@ -124,13 +122,15 @@ pub trait Angle where macro_rules! impl_angle { ($Angle:ident, $fmt:expr, $full_turn:expr, $hi:expr) => { - impl Angle for $Angle { - type Unitless = S; - + impl $Angle { #[inline] - fn new(value: S) -> $Angle { + pub fn new(value: S) -> $Angle { $Angle { s: value } } + } + + impl Angle for $Angle { + type Unitless = S; #[inline] fn zero() -> $Angle {