#[repr(transparent)]
pub struct BoundedI16<const MIN: i16, const MAX: i16>(_);
This is supported on crate feature types
only.
Expand description
An
i16
constrained to be in the range MIN..=MAX
.
impl<const MIN: i16, const MAX: i16> Bounded<MIN, MAX>
The smallest value this bounded integer can contain.
The largest value that this bounded integer can contain.
The smallest value of the bounded integer.
The largest value of the bounded integer.
Creates a bounded integer without checking the value.
The value must not be outside the valid range of values; it must not be less than
MIN_VALUE
or greater than MAX_VALUE
.
Creates a shared reference to a bounded integer from a shared reference to a
primitive.
The value must not be outside the valid range of values; it must not be less than
MIN_VALUE
or greater than MAX_VALUE
.
Creates a mutable reference to a bounded integer from a mutable reference to a
primitive.
The value must not be outside the valid range of values; it must not be less than
MIN_VALUE
or greater than MAX_VALUE
.
Checks whether the given value is in the range of the bounded integer.
Creates a bounded integer if the given value is within the range
[MIN
, MAX
].
Creates a reference to a bounded integer from a reference to a primitive if the
given value is within the range [MIN
, MAX
].
Creates a mutable reference to a bounded integer from a mutable reference to a
primitive if the given value is within the range
[MIN
, MAX
].
Creates a bounded integer by setting the value to MIN
or
MAX
if it is too low or too high respectively.
pub const fn get(self) -> i16
Returns the value of the bounded integer as a primitive type.
pub const fn get_ref(&self) -> &i16
Returns a shared reference to the value of the bounded integer.
pub unsafe fn get_mut(&mut self) -> &mut i16
Returns a mutable reference to the value of the bounded integer.
This value must never be set to a value beyond the range of the bounded integer.
Computes the absolute value of self
, panicking if it is out of range.
pub fn pow(self, exp: u32) -> Self
Raises self
to the power of exp
, using exponentiation by squaring. Panics if it
is out of range.
Calculates the quotient of Euclidean division of self
by rhs
. Panics if rhs
is 0 or the result is out of range.
Calculates the least nonnegative remainder of self (mod rhs)
. Panics if rhs
is 0
or the result is out of range.
Checked integer addition.
Saturating integer addition.
Checked integer subtraction.
Saturating integer subtraction.
Checked integer multiplication.
Saturating integer multiplication.
Checked integer division.
Checked Euclidean division.
Checked integer remainder.
Checked Euclidean remainder.
Saturating absolute value.
Saturating exponentiation.
impl<const MIN: i16, const MAX: i16> Add<&'_ Bounded<MIN, MAX>> for i16
The resulting type after applying the +
operator.
impl<const MIN: i16, const MAX: i16> Add<&'_ Bounded<MIN, MAX>> for &i16
The resulting type after applying the +
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Add<&'_ Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
The resulting type after applying the +
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Add<&'_ Bounded<R_MIN, R_MAX>> for &Bounded<L_MIN, L_MAX>
The resulting type after applying the +
operator.
impl<const MIN: i16, const MAX: i16> Add<&'_ i16> for Bounded<MIN, MAX>
The resulting type after applying the +
operator.
impl<const MIN: i16, const MAX: i16> Add<&'_ i16> for &Bounded<MIN, MAX>
The resulting type after applying the +
operator.
impl<const MIN: i16, const MAX: i16> Add<Bounded<MIN, MAX>> for i16
The resulting type after applying the +
operator.
impl<const MIN: i16, const MAX: i16> Add<Bounded<MIN, MAX>> for &i16
The resulting type after applying the +
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Add<Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
The resulting type after applying the +
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Add<Bounded<R_MIN, R_MAX>> for &Bounded<L_MIN, L_MAX>
The resulting type after applying the +
operator.
impl<const MIN: i16, const MAX: i16> Add<i16> for Bounded<MIN, MAX>
The resulting type after applying the +
operator.
impl<const MIN: i16, const MAX: i16> Add<i16> for &Bounded<MIN, MAX>
The resulting type after applying the +
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> AddAssign<&'_ Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> AddAssign<Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
impl<const MIN: i16, const MAX: i16> AsRef<i16> for Bounded<MIN, MAX>
impl<const MIN: i16, const MAX: i16> Binary for Bounded<MIN, MAX>
Formats the value using the given formatter.
impl<const MIN: i16, const MAX: i16> Borrow<i16> for Bounded<MIN, MAX>
Immutably borrows from an owned value. Read more
impl<const MIN: i16, const MAX: i16> Clone for Bounded<MIN, MAX>
Performs copy-assignment from source
. Read more
impl<const MIN: i16, const MAX: i16> Debug for Bounded<MIN, MAX>
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Formats the value using the given formatter. Read more
impl<const MIN: i16, const MAX: i16> Div<&'_ Bounded<MIN, MAX>> for i16
The resulting type after applying the /
operator.
impl<const MIN: i16, const MAX: i16> Div<&'_ Bounded<MIN, MAX>> for &i16
The resulting type after applying the /
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Div<&'_ Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
The resulting type after applying the /
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Div<&'_ Bounded<R_MIN, R_MAX>> for &Bounded<L_MIN, L_MAX>
The resulting type after applying the /
operator.
impl<const MIN: i16, const MAX: i16> Div<&'_ i16> for Bounded<MIN, MAX>
The resulting type after applying the /
operator.
impl<const MIN: i16, const MAX: i16> Div<&'_ i16> for &Bounded<MIN, MAX>
The resulting type after applying the /
operator.
impl<const MIN: i16, const MAX: i16> Div<Bounded<MIN, MAX>> for i16
The resulting type after applying the /
operator.
impl<const MIN: i16, const MAX: i16> Div<Bounded<MIN, MAX>> for &i16
The resulting type after applying the /
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Div<Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
The resulting type after applying the /
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Div<Bounded<R_MIN, R_MAX>> for &Bounded<L_MIN, L_MAX>
The resulting type after applying the /
operator.
impl<const MIN: i16, const MAX: i16> Div<i16> for Bounded<MIN, MAX>
The resulting type after applying the /
operator.
impl<const MIN: i16, const MAX: i16> Div<i16> for &Bounded<MIN, MAX>
The resulting type after applying the /
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> DivAssign<&'_ Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> DivAssign<Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
impl<const MIN: i16, const MAX: i16> From<Bounded<MIN, MAX>> for i16
impl<const MIN: i16, const MAX: i16> From<Bounded<MIN, MAX>> for i32
impl<const MIN: i16, const MAX: i16> From<Bounded<MIN, MAX>> for i64
impl<const MIN: i16, const MAX: i16> From<Bounded<MIN, MAX>> for i128
impl<const MIN: i16, const MAX: i16> From<Bounded<MIN, MAX>> for isize
impl<const MIN: i16, const MAX: i16> Hash for Bounded<MIN, MAX>
Formats the value using the given formatter.
Formats the value using the given formatter.
impl<const MIN: i16, const MAX: i16> Mul<&'_ Bounded<MIN, MAX>> for i16
The resulting type after applying the *
operator.
impl<const MIN: i16, const MAX: i16> Mul<&'_ Bounded<MIN, MAX>> for &i16
The resulting type after applying the *
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Mul<&'_ Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
The resulting type after applying the *
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Mul<&'_ Bounded<R_MIN, R_MAX>> for &Bounded<L_MIN, L_MAX>
The resulting type after applying the *
operator.
impl<const MIN: i16, const MAX: i16> Mul<&'_ i16> for Bounded<MIN, MAX>
The resulting type after applying the *
operator.
impl<const MIN: i16, const MAX: i16> Mul<&'_ i16> for &Bounded<MIN, MAX>
The resulting type after applying the *
operator.
impl<const MIN: i16, const MAX: i16> Mul<Bounded<MIN, MAX>> for i16
The resulting type after applying the *
operator.
impl<const MIN: i16, const MAX: i16> Mul<Bounded<MIN, MAX>> for &i16
The resulting type after applying the *
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Mul<Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
The resulting type after applying the *
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Mul<Bounded<R_MIN, R_MAX>> for &Bounded<L_MIN, L_MAX>
The resulting type after applying the *
operator.
impl<const MIN: i16, const MAX: i16> Mul<i16> for Bounded<MIN, MAX>
The resulting type after applying the *
operator.
impl<const MIN: i16, const MAX: i16> Mul<i16> for &Bounded<MIN, MAX>
The resulting type after applying the *
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> MulAssign<&'_ Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> MulAssign<Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
impl<const MIN: i16, const MAX: i16> Neg for Bounded<MIN, MAX>
The resulting type after applying the -
operator.
impl<const MIN: i16, const MAX: i16> Neg for &Bounded<MIN, MAX>
The resulting type after applying the -
operator.
impl<const MIN: i16, const MAX: i16> Octal for Bounded<MIN, MAX>
Formats the value using the given formatter.
impl<const MIN: i16, const MAX: i16> Ord for Bounded<MIN, MAX>
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to a certain interval. Read more
impl<const A_MIN: i16, const A_MAX: i16, const B_MIN: i16, const B_MAX: i16> PartialEq<Bounded<B_MIN, B_MAX>> for Bounded<A_MIN, A_MAX>
fn eq(&self, other: &Bounded<B_MIN, B_MAX>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
fn eq(&self, other: &Bounded<MIN, MAX>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
fn eq(&self, other: &i16) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<const A_MIN: i16, const A_MAX: i16, const B_MIN: i16, const B_MAX: i16> PartialOrd<Bounded<B_MIN, B_MAX>> for Bounded<A_MIN, A_MAX>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
Method which takes an iterator and generates Self
from the elements by
multiplying the items. Read more
impl<'a, const MIN: i16, const MAX: i16> Product<&'a Bounded<MIN, MAX>> for i16
Method which takes an iterator and generates Self
from the elements by
multiplying the items. Read more
Method which takes an iterator and generates Self
from the elements by
multiplying the items. Read more
impl<const MIN: i16, const MAX: i16> Product<Bounded<MIN, MAX>> for i16
Method which takes an iterator and generates Self
from the elements by
multiplying the items. Read more
impl<const MIN: i16, const MAX: i16> Rem<&'_ Bounded<MIN, MAX>> for i16
The resulting type after applying the %
operator.
impl<const MIN: i16, const MAX: i16> Rem<&'_ Bounded<MIN, MAX>> for &i16
The resulting type after applying the %
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Rem<&'_ Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
The resulting type after applying the %
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Rem<&'_ Bounded<R_MIN, R_MAX>> for &Bounded<L_MIN, L_MAX>
The resulting type after applying the %
operator.
impl<const MIN: i16, const MAX: i16> Rem<&'_ i16> for Bounded<MIN, MAX>
The resulting type after applying the %
operator.
impl<const MIN: i16, const MAX: i16> Rem<&'_ i16> for &Bounded<MIN, MAX>
The resulting type after applying the %
operator.
impl<const MIN: i16, const MAX: i16> Rem<Bounded<MIN, MAX>> for i16
The resulting type after applying the %
operator.
impl<const MIN: i16, const MAX: i16> Rem<Bounded<MIN, MAX>> for &i16
The resulting type after applying the %
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Rem<Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
The resulting type after applying the %
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Rem<Bounded<R_MIN, R_MAX>> for &Bounded<L_MIN, L_MAX>
The resulting type after applying the %
operator.
impl<const MIN: i16, const MAX: i16> Rem<i16> for Bounded<MIN, MAX>
The resulting type after applying the %
operator.
impl<const MIN: i16, const MAX: i16> Rem<i16> for &Bounded<MIN, MAX>
The resulting type after applying the %
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> RemAssign<&'_ Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> RemAssign<Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
Serialize this value into the given Serde serializer. Read more
impl<const MIN: i16, const MAX: i16> Step for Bounded<MIN, MAX>
🔬 This is a nightly-only experimental API. (step_trait
)
recently redesigned
Returns the number of successor steps required to get from start
to end
. Read more
🔬 This is a nightly-only experimental API. (step_trait
)
recently redesigned
Returns the value that would be obtained by taking the successor
of self
count
times. Read more
🔬 This is a nightly-only experimental API. (step_trait
)
recently redesigned
Returns the value that would be obtained by taking the predecessor
of self
count
times. Read more
fn forward(start: Self, count: usize) -> Self
🔬 This is a nightly-only experimental API. (step_trait
)
recently redesigned
Returns the value that would be obtained by taking the successor
of self
count
times. Read more
🔬 This is a nightly-only experimental API. (step_trait
)
recently redesigned
Returns the value that would be obtained by taking the successor
of self
count
times. Read more
fn backward(start: Self, count: usize) -> Self
🔬 This is a nightly-only experimental API. (step_trait
)
recently redesigned
Returns the value that would be obtained by taking the predecessor
of self
count
times. Read more
🔬 This is a nightly-only experimental API. (step_trait
)
recently redesigned
Returns the value that would be obtained by taking the predecessor
of self
count
times. Read more
impl<const MIN: i16, const MAX: i16> Sub<&'_ Bounded<MIN, MAX>> for i16
The resulting type after applying the -
operator.
impl<const MIN: i16, const MAX: i16> Sub<&'_ Bounded<MIN, MAX>> for &i16
The resulting type after applying the -
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Sub<&'_ Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
The resulting type after applying the -
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Sub<&'_ Bounded<R_MIN, R_MAX>> for &Bounded<L_MIN, L_MAX>
The resulting type after applying the -
operator.
impl<const MIN: i16, const MAX: i16> Sub<&'_ i16> for Bounded<MIN, MAX>
The resulting type after applying the -
operator.
impl<const MIN: i16, const MAX: i16> Sub<&'_ i16> for &Bounded<MIN, MAX>
The resulting type after applying the -
operator.
impl<const MIN: i16, const MAX: i16> Sub<Bounded<MIN, MAX>> for i16
The resulting type after applying the -
operator.
impl<const MIN: i16, const MAX: i16> Sub<Bounded<MIN, MAX>> for &i16
The resulting type after applying the -
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Sub<Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
The resulting type after applying the -
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> Sub<Bounded<R_MIN, R_MAX>> for &Bounded<L_MIN, L_MAX>
The resulting type after applying the -
operator.
impl<const MIN: i16, const MAX: i16> Sub<i16> for Bounded<MIN, MAX>
The resulting type after applying the -
operator.
impl<const MIN: i16, const MAX: i16> Sub<i16> for &Bounded<MIN, MAX>
The resulting type after applying the -
operator.
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> SubAssign<&'_ Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
impl<const L_MIN: i16, const L_MAX: i16, const R_MIN: i16, const R_MAX: i16> SubAssign<Bounded<R_MIN, R_MAX>> for Bounded<L_MIN, L_MAX>
impl<'a, const MIN: i16, const MAX: i16> Sum<&'a Bounded<MIN, MAX>> for Bounded<MIN, MAX>
Method which takes an iterator and generates Self
from the elements by
“summing up” the items. Read more
impl<'a, const MIN: i16, const MAX: i16> Sum<&'a Bounded<MIN, MAX>> for i16
Method which takes an iterator and generates Self
from the elements by
“summing up” the items. Read more
Method which takes an iterator and generates Self
from the elements by
“summing up” the items. Read more
impl<const MIN: i16, const MAX: i16> Sum<Bounded<MIN, MAX>> for i16
Method which takes an iterator and generates Self
from the elements by
“summing up” the items. Read more
Formats the value using the given formatter.
Formats the value using the given formatter.
impl<const MIN: i16, const MAX: i16> Copy for Bounded<MIN, MAX>
impl<const MIN: i16, const MAX: i16> Eq for Bounded<MIN, MAX>
impl<const MIN: i16, const MAX: i16> Send for Bounded<MIN, MAX>
impl<const MIN: i16, const MAX: i16> Sync for Bounded<MIN, MAX>
impl<const MIN: i16, const MAX: i16> Unpin for Bounded<MIN, MAX>
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.