Skip to main content

Ranged

Struct Ranged 

Source
pub struct Ranged<const MIN: i128, const MAX: i128>
where Assert<{ _ }>: IsAllowed,
{ /* private fields */ }
Expand description

A value restricted to the given bounds

Implementations§

Source§

impl<const MIN: i128, const MAX: i128> Ranged<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Source

pub const fn i8(self) -> i8
where Assert<{ _ }>: IsAllowed,

Convert a Ranged into i8 value. Accessible if fits.

Source

pub const fn u8(self) -> u8
where Assert<{ _ }>: IsAllowed,

Convert a Ranged into u8 value. Accessible if fits.

Source

pub const fn i16(self) -> i16
where Assert<{ _ }>: IsAllowed,

Convert a Ranged into i16 value. Accessible if fits.

Source

pub const fn u16(self) -> u16
where Assert<{ _ }>: IsAllowed,

Convert a Ranged into u16 value. Accessible if fits.

Source

pub const fn i32(self) -> i32
where Assert<{ _ }>: IsAllowed,

Convert a Ranged into i32 value. Accessible if fits.

Source

pub const fn u32(self) -> u32
where Assert<{ _ }>: IsAllowed,

Convert a Ranged into u32 value. Accessible if fits.

Source

pub const fn i64(self) -> i64
where Assert<{ _ }>: IsAllowed,

Convert a Ranged into i64 value. Accessible if fits.

Source

pub const fn u64(self) -> u64
where Assert<{ _ }>: IsAllowed,

Convert a Ranged into u64 value. Accessible if fits.

Source

pub const fn i128(self) -> i128
where Assert<{ _ }>: IsAllowed,

Convert a Ranged into i128 value. Accessible if fits.

Source

pub const fn isize(self) -> isize
where Assert<{ _ }>: IsAllowed,

Convert a Ranged into isize value. Accessible if fits.

Source

pub const fn usize(self) -> usize
where Assert<{ _ }>: IsAllowed,

Convert a Ranged into usize value. Accessible if fits.

Source§

impl<const MIN: i128, const MAX: i128> Ranged<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Source

pub const fn expand<const RMIN: i128, const RMAX: i128>( self, ) -> Ranged<RMIN, RMAX>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Convert to the Ranged with the wider bounds

Examples found in repository?
examples/sudoku.rs (line 34)
26pub fn place_number(pos: Ranged<0, 80>, sudoku_ar: &mut Sudoku) -> bool {
27    pos.iter_up()
28        .find_map(|p| {
29                let (x, y) = (p % r!(9), p / r!(9));
30                if sudoku_ar[x][y] == r!(0) {Some((x,y))} else {None}
31            })
32        .is_none_or(|(x, y)| {
33            for n in r!(1..=9) {
34                if is_valid(n.expand(), x, y, sudoku_ar) {
35                    sudoku_ar[x][y] = n.expand();
36                    let next = if let Some(next) = (pos + r!(1)).fit() {next} else {return true};
37                    if place_number(next,sudoku_ar) {
38                        return true;
39                    }
40                    sudoku_ar[x][y] = r!([]0);
41                }
42            }
43            false
44        })
45}
Source

pub const fn fit<const RMIN: i128, const RMAX: i128>( self, ) -> Option<Ranged<RMIN, RMAX>>
where Assert<{ _ }>: IsAllowed,

Convert to the other Ranged, returning None if the value is out of range

Examples found in repository?
examples/sudoku.rs (line 36)
26pub fn place_number(pos: Ranged<0, 80>, sudoku_ar: &mut Sudoku) -> bool {
27    pos.iter_up()
28        .find_map(|p| {
29                let (x, y) = (p % r!(9), p / r!(9));
30                if sudoku_ar[x][y] == r!(0) {Some((x,y))} else {None}
31            })
32        .is_none_or(|(x, y)| {
33            for n in r!(1..=9) {
34                if is_valid(n.expand(), x, y, sudoku_ar) {
35                    sudoku_ar[x][y] = n.expand();
36                    let next = if let Some(next) = (pos + r!(1)).fit() {next} else {return true};
37                    if place_number(next,sudoku_ar) {
38                        return true;
39                    }
40                    sudoku_ar[x][y] = r!([]0);
41                }
42            }
43            false
44        })
45}
Source

pub const fn fit_max<const RMAX: i128>(self) -> Option<Ranged<MIN, RMAX>>
where Assert<{ _ }>: IsAllowed,

Change the MIN value of Ranged bounds, returning None if the value is out of range

Source

pub const fn fit_min<const RMIN: i128>(self) -> Option<Ranged<RMIN, MAX>>
where Assert<{ _ }>: IsAllowed,

Change the MAX value of Ranged bounds, returning None if the value is out of range

Source

pub const fn fit_less_than<const RMIN: i128, const RMAX: i128>( self, other: Ranged<RMIN, RMAX>, ) -> Option<Ranged<MIN, { _ }>>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Compares two Ranged values. If self is less than the other, it returns a Ranged with the same value and shrunk bounds.

Allowed only if the ranges interleave.

Source

pub const fn fit_less_eq<const RMIN: i128, const RMAX: i128>( self, other: Ranged<RMIN, RMAX>, ) -> Option<Ranged<MIN, RMAX>>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Compares two Ranged values. If self is less than or equal to the other, it returns a Ranged with the same value and shrunk bounds.

Allowed only if the ranges interleave.

Source

pub const fn fit_greater_than<const RMIN: i128, const RMAX: i128>( self, other: Ranged<RMIN, RMAX>, ) -> Option<Ranged<{ _ }, MAX>>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Compares two Ranged values. If self is greater than the other, it returns a Ranged with the same value and shrunk bounds.

Allowed only if the ranges interleave.

Source

pub const fn fit_greater_eq<const RMIN: i128, const RMAX: i128>( self, other: Ranged<RMIN, RMAX>, ) -> Option<Ranged<RMIN, MAX>>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Compares two Ranged values. If self is greater than or equal to the other, it returns a Ranged with the same value and shrunk bounds.

Allowed only if the ranges interleave.

Source

pub const fn split<const MID: i128>(self) -> Split<MIN, MID, MAX>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Simple case analysis for Ranged

Source

pub const fn split_subtract<const BMIN: i128, const BMAX: i128>( self, other: Ranged<BMIN, BMAX>, ) -> SplitByDifference<MIN, MAX, BMIN, BMAX>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Narrow ranges guiding by the subtraction of two values

Allowed only if the ranges overlap.

Source§

impl<const MIN: i128, const MAX: i128> Ranged<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Source

pub const fn add<const BMIN: i128, const BMAX: i128>( self, rhs: Ranged<BMIN, BMAX>, ) -> Ranged<{ _ }, { _ }>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Adds two ranged integers, proves the result bounds

Source

pub const fn sub<const BMIN: i128, const BMAX: i128>( self, rhs: Ranged<BMIN, BMAX>, ) -> Ranged<{ _ }, { _ }>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Subtracts two ranged integers, proves the result bounds

Source

pub const fn mul<const BMIN: i128, const BMAX: i128>( self, rhs: Ranged<BMIN, BMAX>, ) -> Ranged<{ _ }, { _ }>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Multiplies two ranged integers, proves the result bounds

Source

pub const fn div<const BMIN: i128, const BMAX: i128>( self, rhs: Ranged<BMIN, BMAX>, ) -> Ranged<{ _ }, { _ }>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Divides two ranged integers, proves the result bounds

Source

pub const fn rem<const BMIN: i128, const BMAX: i128>( self, rhs: Ranged<BMIN, BMAX>, ) -> Ranged<{ _ }, { _ }>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Takes a remainder of two ranged integers division, proves the result bounds

Source

pub const fn min<const BMIN: i128, const BMAX: i128>( self, other: Ranged<BMIN, BMAX>, ) -> Ranged<{ _ }, { _ }>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Returns the minimum of two values

Source

pub const fn max<const BMIN: i128, const BMAX: i128>( self, other: Ranged<BMIN, BMAX>, ) -> Ranged<{ _ }, { _ }>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Returns the maximum of two values

Source

pub const fn abs(self) -> Ranged<{ _ }, { _ }>
where Assert<{ _ }>: IsAllowed,

Computes the absolute value of self

Source

pub const fn neg(self) -> Ranged<{ _ }, { _ }>
where Assert<{ _ }>: IsAllowed,

Computes the negative of self

Source

pub const fn div_euclid<const BMIN: i128, const BMAX: i128>( self, rhs: Ranged<BMIN, BMAX>, ) -> Ranged<{ _ }, { _ }>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Calculates the quotient of Euclidean division of self by rhs

Source

pub const fn rem_euclid<const BMIN: i128, const BMAX: i128>( self, rhs: Ranged<BMIN, BMAX>, ) -> Ranged<{ _ }, { _ }>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Calculates the Euclidean mod of self by rhs

Source

pub const fn eq<const BMIN: i128, const BMAX: i128>( &self, rhs: &Ranged<BMIN, BMAX>, ) -> bool
where Assert<{ _ }>: IsAllowed,

Checks if two numbers are equal

Source

pub const fn ne<const BMIN: i128, const BMAX: i128>( &self, other: &Ranged<BMIN, BMAX>, ) -> bool
where Assert<{ _ }>: IsAllowed,

Checks if two numbers are NOT equal

Source§

impl<const MIN: i128, const MAX: i128> Ranged<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Source

pub const unsafe fn unchecked_new(n: i128) -> Self

Create a Ranged value without checking the bounds.

§Safety

The value (parameter n) must be inside the inclusive range MIN..=MAX. Having an integer outside the bounds is undefined behavior.

Source

pub const fn new(n: i128) -> Option<Self>

Create a Ranged value checking the bounds at runtime

Note: due to incomplete features limitations, the function may fail to compile with the ‘trait bound is not satisfied’ if the bounds are not explicitly specified.

§Example
let input = "42".to_string();
let user_input = input.parse()?;
if let Some(input) = Ranged::<1, 100>::new(user_input){
    println!("The value is in range 1..=100")
}
else {
    println!("The value is too high :(")
}
Source§

impl<const MIN: i128, const MAX: i128> Ranged<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Source

pub const fn create_const<const V: i128>() -> Self
where Assert<{ _ }>: IsAllowed,

Create a Ranged constant checking the bounds at compile time

Consider using r! macro instead

§Example
let a = Ranged::<0, 100>::create_const::<42>();
let a = r!([0 100] 42);
Source

pub const fn iter_up(self) -> Iter<MIN, MAX>

Iterate up from current value to Self::MAX (inclusively) using Self as output

Examples found in repository?
examples/sudoku.rs (line 27)
26pub fn place_number(pos: Ranged<0, 80>, sudoku_ar: &mut Sudoku) -> bool {
27    pos.iter_up()
28        .find_map(|p| {
29                let (x, y) = (p % r!(9), p / r!(9));
30                if sudoku_ar[x][y] == r!(0) {Some((x,y))} else {None}
31            })
32        .is_none_or(|(x, y)| {
33            for n in r!(1..=9) {
34                if is_valid(n.expand(), x, y, sudoku_ar) {
35                    sudoku_ar[x][y] = n.expand();
36                    let next = if let Some(next) = (pos + r!(1)).fit() {next} else {return true};
37                    if place_number(next,sudoku_ar) {
38                        return true;
39                    }
40                    sudoku_ar[x][y] = r!([]0);
41                }
42            }
43            false
44        })
45}

Trait Implementations§

Source§

impl<const AMIN: i128, const AMAX: i128, const BMIN: i128, const BMAX: i128> Add<Ranged<BMIN, BMAX>> for Ranged<AMIN, AMAX>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<{ AMIN + BMIN }, { AMAX + BMAX }>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Ranged<BMIN, BMAX>) -> Self::Output

Performs the + operation. Read more
Source§

impl<const MIN: i128, const MAX: i128> Clone for Ranged<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Source§

fn clone(&self) -> Ranged<MIN, MAX>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const MIN: i128, const MAX: i128> Debug for Ranged<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const MIN: i128, const MAX: i128> Display for Ranged<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const AMIN: i128, const AMAX: i128, const BMIN: i128, const BMAX: i128> Div<Ranged<BMIN, BMAX>> for Ranged<AMIN, AMAX>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<{singleside_div_min(AMIN, AMAX, BMIN, BMAX) }, {singleside_div_max(AMIN, AMAX, BMIN, BMAX) }>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Ranged<BMIN, BMAX>) -> Self::Output

Performs the / operation. Read more
Source§

impl<const MIN: i128, const MAX: i128> From<Ranged<MIN, MAX>> for i128
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn from(a: Ranged<MIN, MAX>) -> Self

Converts to this type from the input type.
Source§

impl<const MIN: i128, const MAX: i128> From<Ranged<MIN, MAX>> for i16
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn from(a: Ranged<MIN, MAX>) -> Self

Converts to this type from the input type.
Source§

impl<const MIN: i128, const MAX: i128> From<Ranged<MIN, MAX>> for i32
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn from(a: Ranged<MIN, MAX>) -> Self

Converts to this type from the input type.
Source§

impl<const MIN: i128, const MAX: i128> From<Ranged<MIN, MAX>> for i64
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn from(a: Ranged<MIN, MAX>) -> Self

Converts to this type from the input type.
Source§

impl<const MIN: i128, const MAX: i128> From<Ranged<MIN, MAX>> for i8
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn from(a: Ranged<MIN, MAX>) -> Self

Converts to this type from the input type.
Source§

impl<const MIN: i128, const MAX: i128> From<Ranged<MIN, MAX>> for isize
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn from(a: Ranged<MIN, MAX>) -> Self

Converts to this type from the input type.
Source§

impl<const MIN: i128, const MAX: i128> From<Ranged<MIN, MAX>> for u16
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn from(a: Ranged<MIN, MAX>) -> Self

Converts to this type from the input type.
Source§

impl<const MIN: i128, const MAX: i128> From<Ranged<MIN, MAX>> for u32
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn from(a: Ranged<MIN, MAX>) -> Self

Converts to this type from the input type.
Source§

impl<const MIN: i128, const MAX: i128> From<Ranged<MIN, MAX>> for u64
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn from(a: Ranged<MIN, MAX>) -> Self

Converts to this type from the input type.
Source§

impl<const MIN: i128, const MAX: i128> From<Ranged<MIN, MAX>> for u8
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn from(a: Ranged<MIN, MAX>) -> Self

Converts to this type from the input type.
Source§

impl<const MIN: i128, const MAX: i128> From<Ranged<MIN, MAX>> for usize
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn from(a: Ranged<MIN, MAX>) -> Self

Converts to this type from the input type.
Source§

impl<const MIN: i128, const MAX: i128> FromStr for Ranged<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Source§

type Err = ParseRangedError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<const MIN: i128, const MAX: i128> Hash for Ranged<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T, const N: usize> Index<Ranged<0, {N as i128 - 1}>> for [T; N]
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: Ranged<0, { _ }>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T, const N: usize> IndexMut<Ranged<0, {N as i128 - 1}>> for [T; N]
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn index_mut(&mut self, index: Ranged<0, { _ }>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<const AMIN: i128, const AMAX: i128, const BMIN: i128, const BMAX: i128> Mul<Ranged<BMIN, BMAX>> for Ranged<AMIN, AMAX>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<{ min_cross(AMIN, AMAX, BMIN, BMAX) }, { max_cross(AMIN, AMAX, BMIN, BMAX) }>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Ranged<BMIN, BMAX>) -> Self::Output

Performs the * operation. Read more
Source§

impl<const MIN: i128, const MAX: i128> Neg for Ranged<MIN, MAX>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<{ -MAX }, { -MIN }>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<const AMIN: i128, const AMAX: i128> Ord for Ranged<AMIN, AMAX>
where Assert<{ _ }>: IsAllowed,

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<const AMIN: i128, const AMAX: i128, const BMIN: i128, const BMAX: i128> PartialEq<Ranged<BMIN, BMAX>> for Ranged<AMIN, AMAX>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn eq(&self, rhs: &Ranged<BMIN, BMAX>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const MIN: i128, const MAX: i128> PartialEq<Ranged<MIN, MAX>> for i128
where Assert<{ _ }>: IsAllowed,

Source§

fn eq(&self, other: &Ranged<MIN, MAX>) -> bool

Tests for self and other values to be equal, and is used by ==.
Source§

fn ne(&self, other: &Ranged<MIN, MAX>) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const MIN: i128, const MAX: i128> PartialEq<i128> for Ranged<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Source§

fn eq(&self, other: &i128) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const AMIN: i128, const AMAX: i128> PartialOrd<Ranged<AMIN, AMAX>> for i128
where Assert<{ _ }>: IsAllowed,

Source§

fn partial_cmp(&self, other: &Ranged<AMIN, AMAX>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
Source§

fn lt(&self, other: &Ranged<AMIN, AMAX>) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
Source§

fn le(&self, other: &Ranged<AMIN, AMAX>) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
Source§

fn gt(&self, other: &Ranged<AMIN, AMAX>) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
Source§

fn ge(&self, other: &Ranged<AMIN, AMAX>) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<const AMIN: i128, const AMAX: i128, const BMIN: i128, const BMAX: i128> PartialOrd<Ranged<BMIN, BMAX>> for Ranged<AMIN, AMAX>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

fn partial_cmp(&self, other: &Ranged<BMIN, BMAX>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
Source§

fn lt(&self, other: &Ranged<BMIN, BMAX>) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
Source§

fn le(&self, other: &Ranged<BMIN, BMAX>) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
Source§

fn gt(&self, other: &Ranged<BMIN, BMAX>) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
Source§

fn ge(&self, other: &Ranged<BMIN, BMAX>) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<const AMIN: i128, const AMAX: i128> PartialOrd<i128> for Ranged<AMIN, AMAX>
where Assert<{ _ }>: IsAllowed,

Source§

fn partial_cmp(&self, other: &i128) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
Source§

fn lt(&self, other: &i128) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
Source§

fn le(&self, other: &i128) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
Source§

fn gt(&self, other: &i128) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
Source§

fn ge(&self, other: &i128) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<const AMIN: i128, const AMAX: i128, const BMIN: i128, const BMAX: i128> Rem<Ranged<BMIN, BMAX>> for Ranged<AMIN, AMAX>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<{ singleside_rem_min(AMIN, AMAX, BMIN, BMAX) }, { singleside_rem_max(AMIN, AMAX, BMIN, BMAX) }>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Ranged<BMIN, BMAX>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const VAL: i128> Rem<Ranged<VAL, VAL>> for i128
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<{1-VAL.abs()}, {VAL.abs()-1}>

The resulting type after applying the % operator.
Source§

fn rem(self, _rhs: Ranged<VAL, VAL>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const VAL: i128> Rem<Ranged<VAL, VAL>> for i16
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<{1-VAL.abs()}, {VAL.abs()-1}>

The resulting type after applying the % operator.
Source§

fn rem(self, _rhs: Ranged<VAL, VAL>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const VAL: i128> Rem<Ranged<VAL, VAL>> for i32
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<{1-VAL.abs()}, {VAL.abs()-1}>

The resulting type after applying the % operator.
Source§

fn rem(self, _rhs: Ranged<VAL, VAL>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const VAL: i128> Rem<Ranged<VAL, VAL>> for i64
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<{1-VAL.abs()}, {VAL.abs()-1}>

The resulting type after applying the % operator.
Source§

fn rem(self, _rhs: Ranged<VAL, VAL>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const VAL: i128> Rem<Ranged<VAL, VAL>> for i8
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<{1-VAL.abs()}, {VAL.abs()-1}>

The resulting type after applying the % operator.
Source§

fn rem(self, _rhs: Ranged<VAL, VAL>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const VAL: i128> Rem<Ranged<VAL, VAL>> for isize
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<{1-VAL.abs()}, {VAL.abs()-1}>

The resulting type after applying the % operator.
Source§

fn rem(self, _rhs: Ranged<VAL, VAL>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const VAL: i128> Rem<Ranged<VAL, VAL>> for u16
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<0, {VAL.abs()-1}>

The resulting type after applying the % operator.
Source§

fn rem(self, _rhs: Ranged<VAL, VAL>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const VAL: i128> Rem<Ranged<VAL, VAL>> for u32
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<0, {VAL.abs()-1}>

The resulting type after applying the % operator.
Source§

fn rem(self, _rhs: Ranged<VAL, VAL>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const VAL: i128> Rem<Ranged<VAL, VAL>> for u64
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<0, {VAL.abs()-1}>

The resulting type after applying the % operator.
Source§

fn rem(self, _rhs: Ranged<VAL, VAL>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const VAL: i128> Rem<Ranged<VAL, VAL>> for u8
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<0, {VAL.abs()-1}>

The resulting type after applying the % operator.
Source§

fn rem(self, _rhs: Ranged<VAL, VAL>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const VAL: i128> Rem<Ranged<VAL, VAL>> for usize
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<0, {VAL.abs()-1}>

The resulting type after applying the % operator.
Source§

fn rem(self, _rhs: Ranged<VAL, VAL>) -> Self::Output

Performs the % operation. Read more
Source§

impl<const AMIN: i128, const AMAX: i128, const BMIN: i128, const BMAX: i128> Sub<Ranged<BMIN, BMAX>> for Ranged<AMIN, AMAX>
where Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed, Assert<{ _ }>: IsAllowed,

Source§

type Output = Ranged<{ AMIN - BMAX }, { AMAX - BMIN }>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Ranged<BMIN, BMAX>) -> Self::Output

Performs the - operation. Read more
Source§

impl<const MIN: i128, const MAX: i128> Copy for Ranged<MIN, MAX>
where Assert<{ _ }>: IsAllowed,

Source§

impl<const AMIN: i128, const AMAX: i128> Eq for Ranged<AMIN, AMAX>
where Assert<{ _ }>: IsAllowed,

Auto Trait Implementations§

§

impl<const MIN: i128, const MAX: i128> Freeze for Ranged<MIN, MAX>

§

impl<const MIN: i128, const MAX: i128> RefUnwindSafe for Ranged<MIN, MAX>

§

impl<const MIN: i128, const MAX: i128> Send for Ranged<MIN, MAX>

§

impl<const MIN: i128, const MAX: i128> Sync for Ranged<MIN, MAX>

§

impl<const MIN: i128, const MAX: i128> Unpin for Ranged<MIN, MAX>

§

impl<const MIN: i128, const MAX: i128> UnwindSafe for Ranged<MIN, MAX>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.