Trait veloren_voxygen::scene::math::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::Output
where 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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl IsBetween for f32

§

type Output = bool

source§

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

source§

impl IsBetween for f64

§

type Output = bool

source§

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

source§

impl IsBetween for i8

§

type Output = bool

source§

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

source§

impl IsBetween for i16

§

type Output = bool

source§

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

source§

impl IsBetween for i32

§

type Output = bool

source§

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

source§

impl IsBetween for i64

§

type Output = bool

source§

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

source§

impl IsBetween for isize

§

type Output = bool

source§

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

source§

impl IsBetween for u8

§

type Output = bool

source§

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

source§

impl IsBetween for u16

§

type Output = bool

source§

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

source§

impl IsBetween for u32

§

type Output = bool

source§

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

source§

impl IsBetween for u64

§

type Output = bool

source§

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

source§

impl IsBetween for usize

§

type Output = bool

source§

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

source§

impl IsBetween for Wrapping<i8>

§

type Output = bool

source§

fn is_between(self, lower: Wrapping<i8>, upper: Wrapping<i8>) -> bool

source§

impl IsBetween for Wrapping<i16>

§

type Output = bool

source§

fn is_between(self, lower: Wrapping<i16>, upper: Wrapping<i16>) -> bool

source§

impl IsBetween for Wrapping<i32>

§

type Output = bool

source§

fn is_between(self, lower: Wrapping<i32>, upper: Wrapping<i32>) -> bool

source§

impl IsBetween for Wrapping<i64>

§

type Output = bool

source§

fn is_between(self, lower: Wrapping<i64>, upper: Wrapping<i64>) -> bool

source§

impl IsBetween for Wrapping<isize>

§

type Output = bool

source§

fn is_between(self, lower: Wrapping<isize>, upper: Wrapping<isize>) -> bool

source§

impl IsBetween for Wrapping<u8>

§

type Output = bool

source§

fn is_between(self, lower: Wrapping<u8>, upper: Wrapping<u8>) -> bool

source§

impl IsBetween for Wrapping<u16>

§

type Output = bool

source§

fn is_between(self, lower: Wrapping<u16>, upper: Wrapping<u16>) -> bool

source§

impl IsBetween for Wrapping<u32>

§

type Output = bool

source§

fn is_between(self, lower: Wrapping<u32>, upper: Wrapping<u32>) -> bool

source§

impl IsBetween for Wrapping<u64>

§

type Output = bool

source§

fn is_between(self, lower: Wrapping<u64>, upper: Wrapping<u64>) -> bool

source§

impl IsBetween for Wrapping<usize>

§

type Output = bool

source§

fn is_between(self, lower: Wrapping<usize>, upper: Wrapping<usize>) -> bool

Implementors§

source§

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

source§

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

source§

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

§

type Output = Rgb<bool>

source§

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

source§

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

source§

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

source§

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

source§

impl<T> IsBetween for veloren_voxygen::scene::math::Extent2<T>
where T: IsBetween<Output = bool>,

source§

impl<T> IsBetween for veloren_voxygen::scene::math::Extent3<T>
where T: IsBetween<Output = bool>,

source§

impl<T> IsBetween for veloren_voxygen::scene::math::Rgb<T>
where T: IsBetween<Output = bool>,

§

type Output = Rgb<bool>

source§

impl<T> IsBetween for veloren_voxygen::scene::math::Rgba<T>
where T: IsBetween<Output = bool>,

source§

impl<T> IsBetween for veloren_voxygen::scene::math::Vec2<T>
where T: IsBetween<Output = bool>,

source§

impl<T> IsBetween for veloren_voxygen::scene::math::Vec3<T>
where T: IsBetween<Output = bool>,

source§

impl<T> IsBetween for veloren_voxygen::scene::math::Vec4<T>
where T: IsBetween<Output = bool>,

source§

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

source§

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

source§

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

§

type Output = Rgb<bool>

source§

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

source§

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

source§

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

source§

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

source§

impl<T> IsBetween<T> for veloren_voxygen::scene::math::Extent2<T>
where T: IsBetween<Output = bool> + Copy,

source§

impl<T> IsBetween<T> for veloren_voxygen::scene::math::Extent3<T>
where T: IsBetween<Output = bool> + Copy,

source§

impl<T> IsBetween<T> for veloren_voxygen::scene::math::Rgb<T>
where T: IsBetween<Output = bool> + Copy,

§

type Output = Rgb<bool>

source§

impl<T> IsBetween<T> for veloren_voxygen::scene::math::Rgba<T>
where T: IsBetween<Output = bool> + Copy,

source§

impl<T> IsBetween<T> for veloren_voxygen::scene::math::Vec2<T>
where T: IsBetween<Output = bool> + Copy,

source§

impl<T> IsBetween<T> for veloren_voxygen::scene::math::Vec3<T>
where T: IsBetween<Output = bool> + Copy,

source§

impl<T> IsBetween<T> for veloren_voxygen::scene::math::Vec4<T>
where T: IsBetween<Output = bool> + Copy,