diff --git a/src/angle.rs b/src/angle.rs index 03764da..8c7b18e 100644 --- a/src/angle.rs +++ b/src/angle.rs @@ -70,8 +70,8 @@ pub impl Radians: Angle { pub impl Radians: Add, Radians> { #[inline(always)] - pure fn add(rhs: &Radians) -> Radians { - Radians(*self + **rhs) + pure fn add(&self, rhs: &Radians) -> Radians { + Radians(**self + **rhs) } } @@ -164,8 +164,8 @@ pub impl Degrees: Angle { pub impl Degrees: Add, Degrees> { #[inline(always)] - pure fn add(rhs: &Degrees) -> Degrees { - Degrees(*self + **rhs) + pure fn add(&self, rhs: &Degrees) -> Degrees { + Degrees(**self + **rhs) } } @@ -277,4 +277,4 @@ pub struct Euler { x: Radians, // pitch y: Radians, // yaw z: Radians, // roll -} \ No newline at end of file +} diff --git a/src/color/color.rs b/src/color/color.rs index 522556f..fa93f02 100644 --- a/src/color/color.rs +++ b/src/color/color.rs @@ -259,7 +259,7 @@ pub impl RGB: Dimensional { pub impl RGB: Index { #[inline(always)] - pure fn index(i: uint) -> T { + pure fn index(&self, i: uint) -> T { unsafe { do buf_as_slice(self.to_ptr(), 3) |slice| { slice[i] } } } } @@ -269,7 +269,7 @@ pub impl RGB: ToPtr { pure fn to_ptr(&self) -> *T { unsafe { transmute::<*RGB, *T>( - to_unsafe_ptr(&*self) + to_unsafe_ptr(self) ) } } @@ -421,7 +421,7 @@ pub impl RGBA: Dimensional { pub impl RGBA: Index { #[inline(always)] - pure fn index(i: uint) -> T { + pure fn index(&self, i: uint) -> T { unsafe { do buf_as_slice(self.to_ptr(), 4) |slice| { slice[i] } } } } @@ -431,7 +431,7 @@ pub impl RGBA: ToPtr { pure fn to_ptr(&self) -> *T { unsafe { transmute::<*RGBA, *T>( - to_unsafe_ptr(&*self) + to_unsafe_ptr(self) ) } } @@ -579,7 +579,7 @@ pub impl HSV: Dimensional { pub impl HSV: Index { #[inline(always)] - pure fn index(i: uint) -> T { + pure fn index(&self, i: uint) -> T { unsafe { do buf_as_slice(self.to_ptr(), 3) |slice| { slice[i] } } } } @@ -589,7 +589,7 @@ pub impl HSV: ToPtr { pure fn to_ptr(&self) -> *T { unsafe { transmute::<*HSV, *T>( - to_unsafe_ptr(&*self) + to_unsafe_ptr(self) ) } } @@ -717,7 +717,7 @@ pub impl HSVA: Dimensional { pub impl HSVA: Index { #[inline(always)] - pure fn index(i: uint) -> T { + pure fn index(&self, i: uint) -> T { unsafe { do buf_as_slice(self.to_ptr(), 4) |slice| { slice[i] } } } } @@ -727,7 +727,7 @@ pub impl HSVA: ToPtr { pure fn to_ptr(&self) -> *T { unsafe { transmute::<*HSVA, *T>( - to_unsafe_ptr(&*self) + to_unsafe_ptr(self) ) } } @@ -814,4 +814,4 @@ pub impl HSVA: Eq { pure fn ne(&self, other: &HSVA) -> bool { !(self == other) } -} \ No newline at end of file +} diff --git a/src/funs/common.rs b/src/funs/common.rs index 160726f..a5baff9 100644 --- a/src/funs/common.rs +++ b/src/funs/common.rs @@ -139,7 +139,7 @@ pub impl f32: Approx { #[inline(always)] pure fn round(&self) -> f32 { f32::round(*self) } // #[inline(always)] pure fn roundEven(&self) -> f32 {} #[inline(always)] pure fn ceil(&self) -> f32 { f32::ceil(*self) } - #[inline(always)] pure fn fract(&self) -> f32 { (*self) - floor(&*self) } + #[inline(always)] pure fn fract(&self) -> f32 { (*self) - floor(self) } } pub impl f64: Approx { @@ -148,7 +148,7 @@ pub impl f64: Approx { #[inline(always)] pure fn round(&self) -> f64 { f64::round(*self) } // #[inline(always)] pure fn roundEven(&self) -> f64 {} #[inline(always)] pure fn ceil(&self) -> f64 { f64::ceil(*self) } - #[inline(always)] pure fn fract(&self) -> f64 { (*self) - floor(&*self) } + #[inline(always)] pure fn fract(&self) -> f64 { (*self) - floor(self) } } pub impl float: Approx { @@ -157,7 +157,7 @@ pub impl float: Approx { #[inline(always)] pure fn round(&self) -> float { f64::round(*self as f64) as float } // #[inline(always)] pure fn roundEven(&self) -> float {} #[inline(always)] pure fn ceil(&self) -> float { f64::ceil(*self as f64) as float } - #[inline(always)] pure fn fract(&self) -> float { (*self) - floor(&*self) } + #[inline(always)] pure fn fract(&self) -> float { (*self) - floor(self) } } @@ -804,4 +804,4 @@ pub impl Vec4: Mix { self[2].step(&edge[2]), self[3].step(&edge[3])) } -} \ No newline at end of file +} diff --git a/src/mat.rs b/src/mat.rs index e9fd8de..3188d52 100644 --- a/src/mat.rs +++ b/src/mat.rs @@ -608,10 +608,10 @@ pub impl Mat2: Dimensional> { pub impl Mat2: Index> { #[inline(always)] - pure fn index(i: uint) -> Vec2 { + pure fn index(&self, i: uint) -> Vec2 { unsafe { do buf_as_slice( transmute::<*Mat2, *Vec2>( - to_unsafe_ptr(&self)), 2) |slice| { slice[i] } + to_unsafe_ptr(self)), 2) |slice| { slice[i] } } } } @@ -621,7 +621,7 @@ pub impl Mat2: ToPtr { pure fn to_ptr(&self) -> *T { unsafe { transmute::<*Mat2, *T>( - to_unsafe_ptr(&*self) + to_unsafe_ptr(self) ) } } @@ -1105,10 +1105,10 @@ pub impl Mat3: Dimensional> { pub impl Mat3: Index> { #[inline(always)] - pure fn index(i: uint) -> Vec3 { + pure fn index(&self, i: uint) -> Vec3 { unsafe { do buf_as_slice( transmute::<*Mat3, *Vec3>( - to_unsafe_ptr(&self)), 3) |slice| { slice[i] } + to_unsafe_ptr(self)), 3) |slice| { slice[i] } } } } @@ -1118,7 +1118,7 @@ pub impl Mat3: ToPtr { pure fn to_ptr(&self) -> *T { unsafe { transmute::<*Mat3, *T>( - to_unsafe_ptr(&*self) + to_unsafe_ptr(self) ) } } @@ -1679,10 +1679,10 @@ pub impl Mat4: Dimensional> { pub impl Mat4: Index> { #[inline(always)] - pure fn index(i: uint) -> Vec4 { + pure fn index(&self, i: uint) -> Vec4 { unsafe { do buf_as_slice( transmute::<*Mat4, *Vec4>( - to_unsafe_ptr(&self)), 4) |slice| { slice[i] } + to_unsafe_ptr(self)), 4) |slice| { slice[i] } } } } @@ -1692,7 +1692,7 @@ pub impl Mat4: ToPtr { pure fn to_ptr(&self) -> *T { unsafe { transmute::<*Mat4, *T>( - to_unsafe_ptr(&*self) + to_unsafe_ptr(self) ) } } diff --git a/src/quat.rs b/src/quat.rs index bb1f1d0..28d83df 100644 --- a/src/quat.rs +++ b/src/quat.rs @@ -241,7 +241,7 @@ pub impl Quat: Dimensional { pub impl Quat: Index { #[inline(always)] - pure fn index(i: uint) -> T { + pure fn index(&self, i: uint) -> T { unsafe { do buf_as_slice(self.to_ptr(), 4) |slice| { slice[i] } } } } @@ -251,7 +251,7 @@ pub impl Quat: ToPtr { pure fn to_ptr(&self) -> *T { unsafe { transmute::<*Quat, *T>( - to_unsafe_ptr(&*self) + to_unsafe_ptr(self) ) } } @@ -454,4 +454,4 @@ pub impl Quat: FuzzyEq { self[2].fuzzy_eq(&other[2]) && self[3].fuzzy_eq(&other[3]) } -} \ No newline at end of file +} diff --git a/src/vec.rs b/src/vec.rs index 61d376d..84d0b2a 100644 --- a/src/vec.rs +++ b/src/vec.rs @@ -314,7 +314,7 @@ pub impl Vec2: Dimensional { pub impl Vec2: Index { #[inline(always)] - pure fn index(i: uint) -> T { + pure fn index(&self, i: uint) -> T { unsafe { do buf_as_slice(self.to_ptr(), 2) |slice| { slice[i] } } } } @@ -324,7 +324,7 @@ pub impl Vec2: ToPtr { pure fn to_ptr(&self) -> *T { unsafe { transmute::<*Vec2, *T>( - to_unsafe_ptr(&*self) + to_unsafe_ptr(self) ) } } @@ -550,7 +550,7 @@ pub impl Vec3: Dimensional { pub impl Vec3: Index { #[inline(always)] - pure fn index(i: uint) -> T { + pure fn index(&self, i: uint) -> T { unsafe { do buf_as_slice(self.to_ptr(), 3) |slice| { slice[i] } } } } @@ -560,7 +560,7 @@ pub impl Vec3: ToPtr { pure fn to_ptr(&self) -> *T { unsafe { transmute::<*Vec3, *T>( - to_unsafe_ptr(&*self) + to_unsafe_ptr(self) ) } } @@ -818,7 +818,7 @@ pub impl Vec4: Dimensional { pub impl Vec4: Index { #[inline(always)] - pure fn index(i: uint) -> T { + pure fn index(&self, i: uint) -> T { unsafe { do buf_as_slice(self.to_ptr(), 4) |slice| { slice[i] } } } } @@ -828,7 +828,7 @@ pub impl Vec4: ToPtr { pure fn to_ptr(&self) -> *T { unsafe { transmute::<*Vec4, *T>( - to_unsafe_ptr(&*self) + to_unsafe_ptr(self) ) } } @@ -1037,4 +1037,4 @@ pub impl Vec4: DefaultEq { self[2].default_eq(&other[2]) && self[3].default_eq(&other[3]) } -} \ No newline at end of file +}