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

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

bool for scalars, or vector of bools for vectors.

Required Methods

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

Provided Methods

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

Implementations on Foreign Types

impl IsBetween for f32
[src]

impl IsBetween for f64
[src]

impl IsBetween for i8
[src]

impl IsBetween for i16
[src]

impl IsBetween for i32
[src]

impl IsBetween for i64
[src]

impl IsBetween for isize
[src]

impl IsBetween for u8
[src]

impl IsBetween for u16
[src]

impl IsBetween for u32
[src]

impl IsBetween for u64
[src]

impl IsBetween for usize
[src]

impl IsBetween for Wrapping<i8>
[src]

impl IsBetween for Wrapping<i16>
[src]

impl IsBetween for Wrapping<i32>
[src]

impl IsBetween for Wrapping<i64>
[src]

impl IsBetween for Wrapping<isize>
[src]

impl IsBetween for Wrapping<u8>
[src]

impl IsBetween for Wrapping<u16>
[src]

impl IsBetween for Wrapping<u32>
[src]

impl IsBetween for Wrapping<u64>
[src]

impl IsBetween for Wrapping<usize>
[src]

Implementors