More explicit self.

This commit is contained in:
Luqman Aden 2012-12-07 19:00:50 -05:00
parent c442cf148e
commit fb59c90b88
6 changed files with 37 additions and 37 deletions

View file

@ -70,8 +70,8 @@ pub impl<T:Copy Float> Radians<T>: Angle<T> {
pub impl<T:Copy Float> Radians<T>: Add<Radians<T>, Radians<T>> {
#[inline(always)]
pure fn add(rhs: &Radians<T>) -> Radians<T> {
Radians(*self + **rhs)
pure fn add(&self, rhs: &Radians<T>) -> Radians<T> {
Radians(**self + **rhs)
}
}
@ -164,8 +164,8 @@ pub impl<T:Copy Float> Degrees<T>: Angle<T> {
pub impl<T:Copy Float> Degrees<T>: Add<Degrees<T>, Degrees<T>> {
#[inline(always)]
pure fn add(rhs: &Degrees<T>) -> Degrees<T> {
Degrees(*self + **rhs)
pure fn add(&self, rhs: &Degrees<T>) -> Degrees<T> {
Degrees(**self + **rhs)
}
}

View file

@ -259,7 +259,7 @@ pub impl<T> RGB<T>: Dimensional<T> {
pub impl<T:Copy> RGB<T>: Index<uint, T> {
#[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<T:Copy> RGB<T>: ToPtr<T> {
pure fn to_ptr(&self) -> *T {
unsafe {
transmute::<*RGB<T>, *T>(
to_unsafe_ptr(&*self)
to_unsafe_ptr(self)
)
}
}
@ -421,7 +421,7 @@ pub impl<T> RGBA<T>: Dimensional<T> {
pub impl<T:Copy> RGBA<T>: Index<uint, T> {
#[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<T:Copy> RGBA<T>: ToPtr<T> {
pure fn to_ptr(&self) -> *T {
unsafe {
transmute::<*RGBA<T>, *T>(
to_unsafe_ptr(&*self)
to_unsafe_ptr(self)
)
}
}
@ -579,7 +579,7 @@ pub impl<T> HSV<T>: Dimensional<T> {
pub impl<T:Copy> HSV<T>: Index<uint, T> {
#[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<T:Copy> HSV<T>: ToPtr<T> {
pure fn to_ptr(&self) -> *T {
unsafe {
transmute::<*HSV<T>, *T>(
to_unsafe_ptr(&*self)
to_unsafe_ptr(self)
)
}
}
@ -717,7 +717,7 @@ pub impl<T> HSVA<T>: Dimensional<T> {
pub impl<T:Copy> HSVA<T>: Index<uint, T> {
#[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<T:Copy> HSVA<T>: ToPtr<T> {
pure fn to_ptr(&self) -> *T {
unsafe {
transmute::<*HSVA<T>, *T>(
to_unsafe_ptr(&*self)
to_unsafe_ptr(self)
)
}
}

View file

@ -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) }
}

View file

@ -608,10 +608,10 @@ pub impl<T:Copy> Mat2<T>: Dimensional<Vec2<T>> {
pub impl<T:Copy> Mat2<T>: Index<uint, Vec2<T>> {
#[inline(always)]
pure fn index(i: uint) -> Vec2<T> {
pure fn index(&self, i: uint) -> Vec2<T> {
unsafe { do buf_as_slice(
transmute::<*Mat2<T>, *Vec2<T>>(
to_unsafe_ptr(&self)), 2) |slice| { slice[i] }
to_unsafe_ptr(self)), 2) |slice| { slice[i] }
}
}
}
@ -621,7 +621,7 @@ pub impl<T:Copy> Mat2<T>: ToPtr<T> {
pure fn to_ptr(&self) -> *T {
unsafe {
transmute::<*Mat2<T>, *T>(
to_unsafe_ptr(&*self)
to_unsafe_ptr(self)
)
}
}
@ -1105,10 +1105,10 @@ pub impl<T:Copy> Mat3<T>: Dimensional<Vec3<T>> {
pub impl<T:Copy> Mat3<T>: Index<uint, Vec3<T>> {
#[inline(always)]
pure fn index(i: uint) -> Vec3<T> {
pure fn index(&self, i: uint) -> Vec3<T> {
unsafe { do buf_as_slice(
transmute::<*Mat3<T>, *Vec3<T>>(
to_unsafe_ptr(&self)), 3) |slice| { slice[i] }
to_unsafe_ptr(self)), 3) |slice| { slice[i] }
}
}
}
@ -1118,7 +1118,7 @@ pub impl<T:Copy> Mat3<T>: ToPtr<T> {
pure fn to_ptr(&self) -> *T {
unsafe {
transmute::<*Mat3<T>, *T>(
to_unsafe_ptr(&*self)
to_unsafe_ptr(self)
)
}
}
@ -1679,10 +1679,10 @@ pub impl<T> Mat4<T>: Dimensional<Vec4<T>> {
pub impl<T:Copy> Mat4<T>: Index<uint, Vec4<T>> {
#[inline(always)]
pure fn index(i: uint) -> Vec4<T> {
pure fn index(&self, i: uint) -> Vec4<T> {
unsafe { do buf_as_slice(
transmute::<*Mat4<T>, *Vec4<T>>(
to_unsafe_ptr(&self)), 4) |slice| { slice[i] }
to_unsafe_ptr(self)), 4) |slice| { slice[i] }
}
}
}
@ -1692,7 +1692,7 @@ pub impl<T:Copy> Mat4<T>: ToPtr<T> {
pure fn to_ptr(&self) -> *T {
unsafe {
transmute::<*Mat4<T>, *T>(
to_unsafe_ptr(&*self)
to_unsafe_ptr(self)
)
}
}

View file

@ -241,7 +241,7 @@ pub impl<T> Quat<T>: Dimensional<T> {
pub impl<T:Copy> Quat<T>: Index<uint, T> {
#[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<T:Copy> Quat<T>: ToPtr<T> {
pure fn to_ptr(&self) -> *T {
unsafe {
transmute::<*Quat<T>, *T>(
to_unsafe_ptr(&*self)
to_unsafe_ptr(self)
)
}
}

View file

@ -314,7 +314,7 @@ pub impl<T> Vec2<T>: Dimensional<T> {
pub impl<T:Copy> Vec2<T>: Index<uint, T> {
#[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<T:Copy> Vec2<T>: ToPtr<T> {
pure fn to_ptr(&self) -> *T {
unsafe {
transmute::<*Vec2<T>, *T>(
to_unsafe_ptr(&*self)
to_unsafe_ptr(self)
)
}
}
@ -550,7 +550,7 @@ pub impl<T> Vec3<T>: Dimensional<T> {
pub impl<T:Copy> Vec3<T>: Index<uint, T> {
#[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<T:Copy> Vec3<T>: ToPtr<T> {
pure fn to_ptr(&self) -> *T {
unsafe {
transmute::<*Vec3<T>, *T>(
to_unsafe_ptr(&*self)
to_unsafe_ptr(self)
)
}
}
@ -818,7 +818,7 @@ pub impl<T> Vec4<T>: Dimensional<T> {
pub impl<T:Copy> Vec4<T>: Index<uint, T> {
#[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<T:Copy> Vec4<T>: ToPtr<T> {
pure fn to_ptr(&self) -> *T {
unsafe {
transmute::<*Vec4<T>, *T>(
to_unsafe_ptr(&*self)
to_unsafe_ptr(self)
)
}
}