[−][src]Enum bounded_integer::examples::BoundedEnum
A bounded enum.
This was generated from:
#[repr(i8)]
pub enum BoundedEnum { -8..8 }
Variants
Implementations
impl BoundedEnum
[src]
pub const MIN_VALUE: i8
[src]
The smallest value that this bounded integer can contain.
pub const MAX_VALUE: i8
[src]
The largest value that this bounded integer can contain.
pub const MIN: Self
[src]
The smallest value of the bounded integer.
pub const MAX: Self
[src]
The largest value of the bounded integer.
pub const RANGE: i8
[src]
The number of values the bounded integer can contain.
#[must_use]pub unsafe fn new_unchecked(n: i8) -> Self
[src]
Creates a bounded integer without checking the value.
Safety
The value must not be outside the valid range of values; it must not be less than
MIN
or greater than MAX
.
#[must_use]pub fn in_range(n: i8) -> bool
[src]
Checks whether the given value is in the range of the bounded integer.
#[must_use]pub fn new(n: i8) -> Option<Self>
[src]
Creates a bounded integer if the given value is within the range [MIN
, MAX
].
#[must_use]pub fn new_saturating(n: i8) -> Self
[src]
Creates a bounded integer by setting the value to MIN
or MAX
if it is too low
or too high respectively.
#[must_use]pub fn new_wrapping(n: i8) -> Self
[src]
Creates a bounded integer by using modulo arithmetic. Values in the range won't be changed but values outside will be wrapped around.
#[must_use]pub fn get(self) -> i8
[src]
Gets the value of the bounded integer as a primitive type.
#[must_use]pub fn abs(self) -> Self
[src]
Computes the absolute value of self
, panicking if it is out of range.
#[must_use]pub fn pow(self, exp: u32) -> Self
[src]
Raises self to the power of exp
, using exponentiation by squaring. Panics if it
is out of range.
#[must_use]pub fn div_euclid(self, rhs: i8) -> Self
[src]
Calculates the quotient of Euclidean division of self
by rhs
. Panics if rhs
is 0 or the result is out of range.
#[must_use]pub fn rem_euclid(self, rhs: i8) -> Self
[src]
Calculates the least nonnegative remainder of self (mod rhs)
. Panics if rhs
is 0
or the result is out of range.
#[must_use]pub fn checked_add(self, rhs: i8) -> Option<Self>
[src]
Checked integer addition.
#[must_use]pub fn saturating_add(self, rhs: i8) -> Self
[src]
Saturing integer addition.
#[must_use]pub fn checked_sub(self, rhs: i8) -> Option<Self>
[src]
Checked integer subtraction.
#[must_use]pub fn saturating_sub(self, rhs: i8) -> Self
[src]
Saturing integer subtraction.
#[must_use]pub fn checked_mul(self, rhs: i8) -> Option<Self>
[src]
Checked integer multiplication.
#[must_use]pub fn saturating_mul(self, rhs: i8) -> Self
[src]
Saturing integer multiplication.
#[must_use]pub fn checked_div(self, rhs: i8) -> Option<Self>
[src]
Checked integer division.
#[must_use]pub fn checked_div_euclid(self, rhs: i8) -> Option<Self>
[src]
Checked Euclidean division.
#[must_use]pub fn checked_rem(self, rhs: i8) -> Option<Self>
[src]
Checked integer remainder.
#[must_use]pub fn checked_rem_euclid(self, rhs: i8) -> Option<Self>
[src]
Checked Euclidean remainder.
#[must_use]pub fn checked_neg(self) -> Option<Self>
[src]
Checked negation.
#[must_use]pub fn checked_abs(self) -> Option<Self>
[src]
Checked absolute value.
#[must_use]pub fn checked_pow(self, rhs: u32) -> Option<Self>
[src]
Checked exponentiation.
#[must_use]pub fn saturating_pow(self, rhs: u32) -> Self
[src]
Saturing exponentiation.
Trait Implementations
impl<'b> Add<&'b BoundedEnum> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the +
operator.
fn add(self, rhs: &'b BoundedEnum) -> Self::Output
[src]
impl<'b, 'a> Add<&'b BoundedEnum> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the +
operator.
fn add(self, rhs: &'b BoundedEnum) -> Self::Output
[src]
impl<'b> Add<&'b i8> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the +
operator.
fn add(self, rhs: &'b i8) -> Self::Output
[src]
impl<'b, 'a> Add<&'b i8> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the +
operator.
fn add(self, rhs: &'b i8) -> Self::Output
[src]
impl Add<BoundedEnum> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the +
operator.
fn add(self, rhs: BoundedEnum) -> Self::Output
[src]
impl<'a> Add<BoundedEnum> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the +
operator.
fn add(self, rhs: BoundedEnum) -> Self::Output
[src]
impl Add<i8> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the +
operator.
fn add(self, rhs: i8) -> Self::Output
[src]
impl<'a> Add<i8> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the +
operator.
fn add(self, rhs: i8) -> Self::Output
[src]
impl<'a> AddAssign<&'a BoundedEnum> for BoundedEnum
[src]
fn add_assign(&mut self, rhs: &'a BoundedEnum)
[src]
impl<'a> AddAssign<&'a i8> for BoundedEnum
[src]
fn add_assign(&mut self, rhs: &'a i8)
[src]
impl AddAssign<BoundedEnum> for BoundedEnum
[src]
fn add_assign(&mut self, rhs: BoundedEnum)
[src]
impl AddAssign<i8> for BoundedEnum
[src]
fn add_assign(&mut self, rhs: i8)
[src]
impl Binary for BoundedEnum
[src]
impl Clone for BoundedEnum
[src]
fn clone(&self) -> BoundedEnum
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for BoundedEnum
[src]
impl Debug for BoundedEnum
[src]
impl Display for BoundedEnum
[src]
impl<'b> Div<&'b BoundedEnum> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the /
operator.
fn div(self, rhs: &'b BoundedEnum) -> Self::Output
[src]
impl<'b, 'a> Div<&'b BoundedEnum> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the /
operator.
fn div(self, rhs: &'b BoundedEnum) -> Self::Output
[src]
impl<'b> Div<&'b i8> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the /
operator.
fn div(self, rhs: &'b i8) -> Self::Output
[src]
impl<'b, 'a> Div<&'b i8> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the /
operator.
fn div(self, rhs: &'b i8) -> Self::Output
[src]
impl Div<BoundedEnum> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the /
operator.
fn div(self, rhs: BoundedEnum) -> Self::Output
[src]
impl<'a> Div<BoundedEnum> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the /
operator.
fn div(self, rhs: BoundedEnum) -> Self::Output
[src]
impl Div<i8> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the /
operator.
fn div(self, rhs: i8) -> Self::Output
[src]
impl<'a> Div<i8> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the /
operator.
fn div(self, rhs: i8) -> Self::Output
[src]
impl<'a> DivAssign<&'a BoundedEnum> for BoundedEnum
[src]
fn div_assign(&mut self, rhs: &'a BoundedEnum)
[src]
impl<'a> DivAssign<&'a i8> for BoundedEnum
[src]
fn div_assign(&mut self, rhs: &'a i8)
[src]
impl DivAssign<BoundedEnum> for BoundedEnum
[src]
fn div_assign(&mut self, rhs: BoundedEnum)
[src]
impl DivAssign<i8> for BoundedEnum
[src]
fn div_assign(&mut self, rhs: i8)
[src]
impl Eq for BoundedEnum
[src]
impl Hash for BoundedEnum
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl LowerExp for BoundedEnum
[src]
impl LowerHex for BoundedEnum
[src]
impl<'b> Mul<&'b BoundedEnum> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b BoundedEnum) -> Self::Output
[src]
impl<'b, 'a> Mul<&'b BoundedEnum> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b BoundedEnum) -> Self::Output
[src]
impl<'b> Mul<&'b i8> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b i8) -> Self::Output
[src]
impl<'b, 'a> Mul<&'b i8> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b i8) -> Self::Output
[src]
impl Mul<BoundedEnum> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the *
operator.
fn mul(self, rhs: BoundedEnum) -> Self::Output
[src]
impl<'a> Mul<BoundedEnum> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the *
operator.
fn mul(self, rhs: BoundedEnum) -> Self::Output
[src]
impl Mul<i8> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the *
operator.
fn mul(self, rhs: i8) -> Self::Output
[src]
impl<'a> Mul<i8> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the *
operator.
fn mul(self, rhs: i8) -> Self::Output
[src]
impl<'a> MulAssign<&'a BoundedEnum> for BoundedEnum
[src]
fn mul_assign(&mut self, rhs: &'a BoundedEnum)
[src]
impl<'a> MulAssign<&'a i8> for BoundedEnum
[src]
fn mul_assign(&mut self, rhs: &'a i8)
[src]
impl MulAssign<BoundedEnum> for BoundedEnum
[src]
fn mul_assign(&mut self, rhs: BoundedEnum)
[src]
impl MulAssign<i8> for BoundedEnum
[src]
fn mul_assign(&mut self, rhs: i8)
[src]
impl Neg for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl<'a> Neg for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl Octal for BoundedEnum
[src]
impl Ord for BoundedEnum
[src]
fn cmp(&self, other: &BoundedEnum) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<BoundedEnum> for BoundedEnum
[src]
fn eq(&self, other: &BoundedEnum) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<BoundedEnum> for BoundedEnum
[src]
fn partial_cmp(&self, other: &BoundedEnum) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'b> Rem<&'b BoundedEnum> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the %
operator.
fn rem(self, rhs: &'b BoundedEnum) -> Self::Output
[src]
impl<'b, 'a> Rem<&'b BoundedEnum> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the %
operator.
fn rem(self, rhs: &'b BoundedEnum) -> Self::Output
[src]
impl<'b> Rem<&'b i8> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the %
operator.
fn rem(self, rhs: &'b i8) -> Self::Output
[src]
impl<'b, 'a> Rem<&'b i8> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the %
operator.
fn rem(self, rhs: &'b i8) -> Self::Output
[src]
impl Rem<BoundedEnum> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the %
operator.
fn rem(self, rhs: BoundedEnum) -> Self::Output
[src]
impl<'a> Rem<BoundedEnum> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the %
operator.
fn rem(self, rhs: BoundedEnum) -> Self::Output
[src]
impl Rem<i8> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the %
operator.
fn rem(self, rhs: i8) -> Self::Output
[src]
impl<'a> Rem<i8> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the %
operator.
fn rem(self, rhs: i8) -> Self::Output
[src]
impl<'a> RemAssign<&'a BoundedEnum> for BoundedEnum
[src]
fn rem_assign(&mut self, rhs: &'a BoundedEnum)
[src]
impl<'a> RemAssign<&'a i8> for BoundedEnum
[src]
fn rem_assign(&mut self, rhs: &'a i8)
[src]
impl RemAssign<BoundedEnum> for BoundedEnum
[src]
fn rem_assign(&mut self, rhs: BoundedEnum)
[src]
impl RemAssign<i8> for BoundedEnum
[src]
fn rem_assign(&mut self, rhs: i8)
[src]
impl StructuralEq for BoundedEnum
[src]
impl StructuralPartialEq for BoundedEnum
[src]
impl<'b> Sub<&'b BoundedEnum> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the -
operator.
fn sub(self, rhs: &'b BoundedEnum) -> Self::Output
[src]
impl<'b, 'a> Sub<&'b BoundedEnum> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the -
operator.
fn sub(self, rhs: &'b BoundedEnum) -> Self::Output
[src]
impl<'b> Sub<&'b i8> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the -
operator.
fn sub(self, rhs: &'b i8) -> Self::Output
[src]
impl<'b, 'a> Sub<&'b i8> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the -
operator.
fn sub(self, rhs: &'b i8) -> Self::Output
[src]
impl Sub<BoundedEnum> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the -
operator.
fn sub(self, rhs: BoundedEnum) -> Self::Output
[src]
impl<'a> Sub<BoundedEnum> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the -
operator.
fn sub(self, rhs: BoundedEnum) -> Self::Output
[src]
impl Sub<i8> for BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the -
operator.
fn sub(self, rhs: i8) -> Self::Output
[src]
impl<'a> Sub<i8> for &'a BoundedEnum
[src]
type Output = BoundedEnum
The resulting type after applying the -
operator.
fn sub(self, rhs: i8) -> Self::Output
[src]
impl<'a> SubAssign<&'a BoundedEnum> for BoundedEnum
[src]
fn sub_assign(&mut self, rhs: &'a BoundedEnum)
[src]
impl<'a> SubAssign<&'a i8> for BoundedEnum
[src]
fn sub_assign(&mut self, rhs: &'a i8)
[src]
impl SubAssign<BoundedEnum> for BoundedEnum
[src]
fn sub_assign(&mut self, rhs: BoundedEnum)
[src]
impl SubAssign<i8> for BoundedEnum
[src]
fn sub_assign(&mut self, rhs: i8)
[src]
impl UpperExp for BoundedEnum
[src]
impl UpperHex for BoundedEnum
[src]
Auto Trait Implementations
impl RefUnwindSafe for BoundedEnum
impl Send for BoundedEnum
impl Sync for BoundedEnum
impl Unpin for BoundedEnum
impl UnwindSafe for BoundedEnum
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,