diff --git a/src/funs/boolv.rs b/src/funs/boolv.rs index 39b18fc..5f416eb 100644 --- a/src/funs/boolv.rs +++ b/src/funs/boolv.rs @@ -1,53 +1,53 @@ use vector::{Vec2, Vec3, Vec4}; pub trait BooleanVector { - pub fn any() -> bool; - pub fn all() -> bool; - pub fn not() -> self; + pure fn any() -> bool; + pure fn all() -> bool; + pure fn not() -> self; } -#[inline(always)] pub fn any(x: &T) -> bool { x.any() } -#[inline(always)] pub fn all(x: &T) -> bool { x.all() } -#[inline(always)] pub fn not(x: &T) -> T { x.not() } +#[inline(always)] pub pure fn any(x: &T) -> bool { x.any() } +#[inline(always)] pub pure fn all(x: &T) -> bool { x.all() } +#[inline(always)] pub pure fn not(x: &T) -> T { x.not() } pub impl Vec2: BooleanVector { - pub fn any() -> bool { + pure fn any() -> bool { self[0] || self[1] } - pub fn all() -> bool { + pure fn all() -> bool { self[0] && self[1] } - pub fn not() -> Vec2 { + pure fn not() -> Vec2 { Vec2::new(!self[0], !self[1]) } } pub impl Vec3: BooleanVector { - pub fn any() -> bool { + pure fn any() -> bool { self[0] || self[1] || self[2] } - pub fn all() -> bool { + pure fn all() -> bool { self[0] && self[1] && self[2] } - pub fn not() -> Vec3 { + pure fn not() -> Vec3 { Vec3::new(!self[0], !self[1], !self[2]) } } pub impl Vec4: BooleanVector { - pub fn any() -> bool { + pure fn any() -> bool { self[0] || self[1] || self[2] || self[3] } - pub fn all() -> bool { + pure fn all() -> bool { self[0] && self[1] && self[2] && self[3] } - pub fn not() -> Vec4 { + pure fn not() -> Vec4 { Vec4::new(!self[0], !self[1], !self[2], !self[3]) } } \ No newline at end of file