More explicit self.
This commit is contained in:
parent
c442cf148e
commit
fb59c90b88
6 changed files with 37 additions and 37 deletions
|
@ -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>> {
|
pub impl<T:Copy Float> Radians<T>: Add<Radians<T>, Radians<T>> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pure fn add(rhs: &Radians<T>) -> Radians<T> {
|
pure fn add(&self, rhs: &Radians<T>) -> Radians<T> {
|
||||||
Radians(*self + **rhs)
|
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>> {
|
pub impl<T:Copy Float> Degrees<T>: Add<Degrees<T>, Degrees<T>> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pure fn add(rhs: &Degrees<T>) -> Degrees<T> {
|
pure fn add(&self, rhs: &Degrees<T>) -> Degrees<T> {
|
||||||
Degrees(*self + **rhs)
|
Degrees(**self + **rhs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -259,7 +259,7 @@ pub impl<T> RGB<T>: Dimensional<T> {
|
||||||
|
|
||||||
pub impl<T:Copy> RGB<T>: Index<uint, T> {
|
pub impl<T:Copy> RGB<T>: Index<uint, T> {
|
||||||
#[inline(always)]
|
#[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] } }
|
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 {
|
pure fn to_ptr(&self) -> *T {
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute::<*RGB<T>, *T>(
|
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> {
|
pub impl<T:Copy> RGBA<T>: Index<uint, T> {
|
||||||
#[inline(always)]
|
#[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] } }
|
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 {
|
pure fn to_ptr(&self) -> *T {
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute::<*RGBA<T>, *T>(
|
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> {
|
pub impl<T:Copy> HSV<T>: Index<uint, T> {
|
||||||
#[inline(always)]
|
#[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] } }
|
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 {
|
pure fn to_ptr(&self) -> *T {
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute::<*HSV<T>, *T>(
|
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> {
|
pub impl<T:Copy> HSVA<T>: Index<uint, T> {
|
||||||
#[inline(always)]
|
#[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] } }
|
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 {
|
pure fn to_ptr(&self) -> *T {
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute::<*HSVA<T>, *T>(
|
transmute::<*HSVA<T>, *T>(
|
||||||
to_unsafe_ptr(&*self)
|
to_unsafe_ptr(self)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ pub impl f32: Approx {
|
||||||
#[inline(always)] pure fn round(&self) -> f32 { f32::round(*self) }
|
#[inline(always)] pure fn round(&self) -> f32 { f32::round(*self) }
|
||||||
// #[inline(always)] pure fn roundEven(&self) -> f32 {}
|
// #[inline(always)] pure fn roundEven(&self) -> f32 {}
|
||||||
#[inline(always)] pure fn ceil(&self) -> f32 { f32::ceil(*self) }
|
#[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 {
|
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 round(&self) -> f64 { f64::round(*self) }
|
||||||
// #[inline(always)] pure fn roundEven(&self) -> f64 {}
|
// #[inline(always)] pure fn roundEven(&self) -> f64 {}
|
||||||
#[inline(always)] pure fn ceil(&self) -> f64 { f64::ceil(*self) }
|
#[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 {
|
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 round(&self) -> float { f64::round(*self as f64) as float }
|
||||||
// #[inline(always)] pure fn roundEven(&self) -> 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 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) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
18
src/mat.rs
18
src/mat.rs
|
@ -608,10 +608,10 @@ pub impl<T:Copy> Mat2<T>: Dimensional<Vec2<T>> {
|
||||||
|
|
||||||
pub impl<T:Copy> Mat2<T>: Index<uint, Vec2<T>> {
|
pub impl<T:Copy> Mat2<T>: Index<uint, Vec2<T>> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pure fn index(i: uint) -> Vec2<T> {
|
pure fn index(&self, i: uint) -> Vec2<T> {
|
||||||
unsafe { do buf_as_slice(
|
unsafe { do buf_as_slice(
|
||||||
transmute::<*Mat2<T>, *Vec2<T>>(
|
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 {
|
pure fn to_ptr(&self) -> *T {
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute::<*Mat2<T>, *T>(
|
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>> {
|
pub impl<T:Copy> Mat3<T>: Index<uint, Vec3<T>> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pure fn index(i: uint) -> Vec3<T> {
|
pure fn index(&self, i: uint) -> Vec3<T> {
|
||||||
unsafe { do buf_as_slice(
|
unsafe { do buf_as_slice(
|
||||||
transmute::<*Mat3<T>, *Vec3<T>>(
|
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 {
|
pure fn to_ptr(&self) -> *T {
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute::<*Mat3<T>, *T>(
|
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>> {
|
pub impl<T:Copy> Mat4<T>: Index<uint, Vec4<T>> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pure fn index(i: uint) -> Vec4<T> {
|
pure fn index(&self, i: uint) -> Vec4<T> {
|
||||||
unsafe { do buf_as_slice(
|
unsafe { do buf_as_slice(
|
||||||
transmute::<*Mat4<T>, *Vec4<T>>(
|
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 {
|
pure fn to_ptr(&self) -> *T {
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute::<*Mat4<T>, *T>(
|
transmute::<*Mat4<T>, *T>(
|
||||||
to_unsafe_ptr(&*self)
|
to_unsafe_ptr(self)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,7 +241,7 @@ pub impl<T> Quat<T>: Dimensional<T> {
|
||||||
|
|
||||||
pub impl<T:Copy> Quat<T>: Index<uint, T> {
|
pub impl<T:Copy> Quat<T>: Index<uint, T> {
|
||||||
#[inline(always)]
|
#[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] } }
|
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 {
|
pure fn to_ptr(&self) -> *T {
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute::<*Quat<T>, *T>(
|
transmute::<*Quat<T>, *T>(
|
||||||
to_unsafe_ptr(&*self)
|
to_unsafe_ptr(self)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
src/vec.rs
12
src/vec.rs
|
@ -314,7 +314,7 @@ pub impl<T> Vec2<T>: Dimensional<T> {
|
||||||
|
|
||||||
pub impl<T:Copy> Vec2<T>: Index<uint, T> {
|
pub impl<T:Copy> Vec2<T>: Index<uint, T> {
|
||||||
#[inline(always)]
|
#[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] } }
|
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 {
|
pure fn to_ptr(&self) -> *T {
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute::<*Vec2<T>, *T>(
|
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> {
|
pub impl<T:Copy> Vec3<T>: Index<uint, T> {
|
||||||
#[inline(always)]
|
#[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] } }
|
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 {
|
pure fn to_ptr(&self) -> *T {
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute::<*Vec3<T>, *T>(
|
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> {
|
pub impl<T:Copy> Vec4<T>: Index<uint, T> {
|
||||||
#[inline(always)]
|
#[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] } }
|
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 {
|
pure fn to_ptr(&self) -> *T {
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute::<*Vec4<T>, *T>(
|
transmute::<*Vec4<T>, *T>(
|
||||||
to_unsafe_ptr(&*self)
|
to_unsafe_ptr(self)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue