Trait vek::ops::IsBetween

source ·
pub trait IsBetween<Bound = Self>: Sized {
    type Output;

    // Required method
    fn is_between(self, lower: Bound, upper: Bound) -> Self::Output;

    // Provided methods
    fn is_between01(self) -> Self::Output
       where Bound: Zero + One { ... }
    fn is_between_inclusive_range_bounds(
        self,
        range: RangeInclusive<Bound>
    ) -> Self::Output { ... }
}
Expand description

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

Required Associated Types§

source

type Output

bool for scalars, or vector of bools for vectors.

Required Methods§

source

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

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

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)));

Provided Methods§

source

fn is_between01(self) -> Self::Outputwhere Bound: Zero + One,

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

source

fn is_between_inclusive_range_bounds( self, range: RangeInclusive<Bound> ) -> Self::Output

Returns whether this value is between the lower and upper bounds of this inclusive range. This is redundant with RangeInclusive::contains(), but is still useful for generics that use the IsBetween trait.

Implementations on Foreign Types§

source§

impl IsBetween<f64> for f64

§

type Output = bool

source§

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

source§

impl IsBetween<Wrapping<i32>> for Wrapping<i32>

§

type Output = bool

source§

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

source§

impl IsBetween<u32> for u32

§

type Output = bool

source§

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

source§

impl IsBetween<Wrapping<i8>> for Wrapping<i8>

§

type Output = bool

source§

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

source§

impl IsBetween<Wrapping<usize>> for Wrapping<usize>

§

type Output = bool

source§

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

source§

impl IsBetween<Wrapping<i64>> for Wrapping<i64>

§

type Output = bool

source§

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

source§

impl IsBetween<isize> for isize

§

type Output = bool

source§

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

source§

impl IsBetween<i16> for i16

§

type Output = bool

source§

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

source§

impl IsBetween<f32> for f32

§

type Output = bool

source§

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

source§

impl IsBetween<Wrapping<u8>> for Wrapping<u8>

§

type Output = bool

source§

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

source§

impl IsBetween<Wrapping<u16>> for Wrapping<u16>

§

type Output = bool

source§

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

source§

impl IsBetween<u8> for u8

§

type Output = bool

source§

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

source§

impl IsBetween<u64> for u64

§

type Output = bool

source§

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

source§

impl IsBetween<usize> for usize

§

type Output = bool

source§

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

source§

impl IsBetween<i64> for i64

§

type Output = bool

source§

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

source§

impl IsBetween<i8> for i8

§

type Output = bool

source§

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

source§

impl IsBetween<i32> for i32

§

type Output = bool

source§

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

source§

impl IsBetween<Wrapping<isize>> for Wrapping<isize>

§

type Output = bool

source§

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

source§

impl IsBetween<Wrapping<i16>> for Wrapping<i16>

§

type Output = bool

source§

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

source§

impl IsBetween<Wrapping<u32>> for Wrapping<u32>

§

type Output = bool

source§

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

source§

impl IsBetween<u16> for u16

§

type Output = bool

source§

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

source§

impl IsBetween<Wrapping<u64>> for Wrapping<u64>

§

type Output = bool

source§

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

Implementors§

source§

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

source§

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

source§

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

§

type Output = Rgb<bool>

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

§

type Output = Rgb<bool>

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

§

type Output = Rgb<bool>

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

§

type Output = Rgb<bool>

source§

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

source§

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

source§

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

source§

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