[][src]Trait vek::ops::IsBetween

pub trait IsBetween<Bound = Self>: Sized {
    type Output;
    fn is_between(self, lower: Bound, upper: Bound) -> Self::Output;

    fn is_between01(self) -> Self::Output
    where
        Bound: Zero + One
, { ... } }

A value that can tell whether or not it is between two bounds (inclusive).

Associated Types

type Output

bool for scalars, or vector of bools for vectors.

Loading content...

Required methods

fn is_between(self, lower: Bound, upper: Bound) -> Self::Output

Returns whether this value is between lower and upper (inclusive).

This would rather make use of inclusive ranges, but it's an unstable feature.

Panics

Panics if lower is greater than upper. Swap the values yourself if necessary.

use vek::ops::IsBetween;

assert!(5_i32 .is_between(5, 10));
assert!(7_i32 .is_between(5, 10));
assert!(10_i32.is_between(5, 10));
assert!(!(4_i32 .is_between(5, 10)));
assert!(!(11_i32.is_between(5, 10)));
Loading content...

Provided methods

fn is_between01(self) -> Self::Output where
    Bound: Zero + One

Returns whether this value is between 0 and 1 (inclusive).

Loading content...

Implementations on Foreign Types

impl IsBetween<f32> for f32[src]

type Output = bool

impl IsBetween<f64> for f64[src]

type Output = bool

impl IsBetween<i8> for i8[src]

type Output = bool

impl IsBetween<i16> for i16[src]

type Output = bool

impl IsBetween<i32> for i32[src]

type Output = bool

impl IsBetween<i64> for i64[src]

type Output = bool

impl IsBetween<isize> for isize[src]

type Output = bool

impl IsBetween<u8> for u8[src]

type Output = bool

impl IsBetween<u16> for u16[src]

type Output = bool

impl IsBetween<u32> for u32[src]

type Output = bool

impl IsBetween<u64> for u64[src]

type Output = bool

impl IsBetween<usize> for usize[src]

type Output = bool

impl IsBetween<Wrapping<i8>> for Wrapping<i8>[src]

type Output = bool

impl IsBetween<Wrapping<i16>> for Wrapping<i16>[src]

type Output = bool

impl IsBetween<Wrapping<i32>> for Wrapping<i32>[src]

type Output = bool

impl IsBetween<Wrapping<i64>> for Wrapping<i64>[src]

type Output = bool

impl IsBetween<Wrapping<isize>> for Wrapping<isize>[src]

type Output = bool

impl IsBetween<Wrapping<u8>> for Wrapping<u8>[src]

type Output = bool

impl IsBetween<Wrapping<u16>> for Wrapping<u16>[src]

type Output = bool

impl IsBetween<Wrapping<u32>> for Wrapping<u32>[src]

type Output = bool

impl IsBetween<Wrapping<u64>> for Wrapping<u64>[src]

type Output = bool

impl IsBetween<Wrapping<usize>> for Wrapping<usize>[src]

type Output = bool

Loading content...

Implementors

impl<T: IsBetween<Output = bool> + Copy> IsBetween<T> for vek::vec::repr_c::extent2::Extent2<T>[src]

type Output = Extent2<bool>

impl<T: IsBetween<Output = bool> + Copy> IsBetween<T> for vek::vec::repr_c::extent3::Extent3<T>[src]

type Output = Extent3<bool>

impl<T: IsBetween<Output = bool> + Copy> IsBetween<T> for vek::vec::repr_c::rgb::Rgb<T>[src]

type Output = Rgb<bool>

impl<T: IsBetween<Output = bool> + Copy> IsBetween<T> for vek::vec::repr_c::rgba::Rgba<T>[src]

type Output = Rgba<bool>

impl<T: IsBetween<Output = bool> + Copy> IsBetween<T> for vek::vec::repr_c::vec2::Vec2<T>[src]

type Output = Vec2<bool>

impl<T: IsBetween<Output = bool> + Copy> IsBetween<T> for vek::vec::repr_c::vec3::Vec3<T>[src]

type Output = Vec3<bool>

impl<T: IsBetween<Output = bool> + Copy> IsBetween<T> for vek::vec::repr_c::vec4::Vec4<T>[src]

type Output = Vec4<bool>

impl<T: IsBetween<Output = bool> + Copy> IsBetween<T> for vek::vec::repr_simd::extent2::Extent2<T>[src]

type Output = Extent2<bool>

impl<T: IsBetween<Output = bool> + Copy> IsBetween<T> for vek::vec::repr_simd::extent3::Extent3<T>[src]

type Output = Extent3<bool>

impl<T: IsBetween<Output = bool> + Copy> IsBetween<T> for vek::vec::repr_simd::rgb::Rgb<T>[src]

type Output = Rgb<bool>

impl<T: IsBetween<Output = bool> + Copy> IsBetween<T> for vek::vec::repr_simd::rgba::Rgba<T>[src]

type Output = Rgba<bool>

impl<T: IsBetween<Output = bool> + Copy> IsBetween<T> for vek::vec::repr_simd::vec2::Vec2<T>[src]

type Output = Vec2<bool>

impl<T: IsBetween<Output = bool> + Copy> IsBetween<T> for vek::vec::repr_simd::vec3::Vec3<T>[src]

type Output = Vec3<bool>

impl<T: IsBetween<Output = bool> + Copy> IsBetween<T> for vek::vec::repr_simd::vec4::Vec4<T>[src]

type Output = Vec4<bool>

impl<T: IsBetween<Output = bool>> IsBetween<Extent2<T>> for vek::vec::repr_c::extent2::Extent2<T>[src]

type Output = Extent2<bool>

impl<T: IsBetween<Output = bool>> IsBetween<Extent3<T>> for vek::vec::repr_c::extent3::Extent3<T>[src]

type Output = Extent3<bool>

impl<T: IsBetween<Output = bool>> IsBetween<Rgb<T>> for vek::vec::repr_c::rgb::Rgb<T>[src]

type Output = Rgb<bool>

impl<T: IsBetween<Output = bool>> IsBetween<Rgba<T>> for vek::vec::repr_c::rgba::Rgba<T>[src]

type Output = Rgba<bool>

impl<T: IsBetween<Output = bool>> IsBetween<Vec2<T>> for vek::vec::repr_c::vec2::Vec2<T>[src]

type Output = Vec2<bool>

impl<T: IsBetween<Output = bool>> IsBetween<Vec3<T>> for vek::vec::repr_c::vec3::Vec3<T>[src]

type Output = Vec3<bool>

impl<T: IsBetween<Output = bool>> IsBetween<Vec4<T>> for vek::vec::repr_c::vec4::Vec4<T>[src]

type Output = Vec4<bool>

impl<T: IsBetween<Output = bool>> IsBetween<Extent2<T>> for vek::vec::repr_simd::extent2::Extent2<T>[src]

type Output = Extent2<bool>

impl<T: IsBetween<Output = bool>> IsBetween<Extent3<T>> for vek::vec::repr_simd::extent3::Extent3<T>[src]

type Output = Extent3<bool>

impl<T: IsBetween<Output = bool>> IsBetween<Rgb<T>> for vek::vec::repr_simd::rgb::Rgb<T>[src]

type Output = Rgb<bool>

impl<T: IsBetween<Output = bool>> IsBetween<Rgba<T>> for vek::vec::repr_simd::rgba::Rgba<T>[src]

type Output = Rgba<bool>

impl<T: IsBetween<Output = bool>> IsBetween<Vec2<T>> for vek::vec::repr_simd::vec2::Vec2<T>[src]

type Output = Vec2<bool>

impl<T: IsBetween<Output = bool>> IsBetween<Vec3<T>> for vek::vec::repr_simd::vec3::Vec3<T>[src]

type Output = Vec3<bool>

impl<T: IsBetween<Output = bool>> IsBetween<Vec4<T>> for vek::vec::repr_simd::vec4::Vec4<T>[src]

type Output = Vec4<bool>

Loading content...