[−][src]Struct bounded_integer::examples::BoundedStruct
A bounded struct, implemented as a protected newtype.
This was generated from:
#[repr(i8)]
pub struct BoundedStruct { -8..8 }
Implementations
impl BoundedStruct
[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 BoundedStruct> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the +
operator.
fn add(self, rhs: &'b BoundedStruct) -> Self::Output
[src]
impl<'b, 'a> Add<&'b BoundedStruct> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the +
operator.
fn add(self, rhs: &'b BoundedStruct) -> Self::Output
[src]
impl<'b> Add<&'b i8> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the +
operator.
fn add(self, rhs: &'b i8) -> Self::Output
[src]
impl<'b, 'a> Add<&'b i8> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the +
operator.
fn add(self, rhs: &'b i8) -> Self::Output
[src]
impl Add<BoundedStruct> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the +
operator.
fn add(self, rhs: BoundedStruct) -> Self::Output
[src]
impl<'a> Add<BoundedStruct> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the +
operator.
fn add(self, rhs: BoundedStruct) -> Self::Output
[src]
impl Add<i8> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the +
operator.
fn add(self, rhs: i8) -> Self::Output
[src]
impl<'a> Add<i8> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the +
operator.
fn add(self, rhs: i8) -> Self::Output
[src]
impl<'a> AddAssign<&'a BoundedStruct> for BoundedStruct
[src]
fn add_assign(&mut self, rhs: &'a BoundedStruct)
[src]
impl<'a> AddAssign<&'a i8> for BoundedStruct
[src]
fn add_assign(&mut self, rhs: &'a i8)
[src]
impl AddAssign<BoundedStruct> for BoundedStruct
[src]
fn add_assign(&mut self, rhs: BoundedStruct)
[src]
impl AddAssign<i8> for BoundedStruct
[src]
fn add_assign(&mut self, rhs: i8)
[src]
impl Binary for BoundedStruct
[src]
impl Clone for BoundedStruct
[src]
fn clone(&self) -> BoundedStruct
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for BoundedStruct
[src]
impl Debug for BoundedStruct
[src]
impl Display for BoundedStruct
[src]
impl<'b> Div<&'b BoundedStruct> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the /
operator.
fn div(self, rhs: &'b BoundedStruct) -> Self::Output
[src]
impl<'b, 'a> Div<&'b BoundedStruct> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the /
operator.
fn div(self, rhs: &'b BoundedStruct) -> Self::Output
[src]
impl<'b> Div<&'b i8> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the /
operator.
fn div(self, rhs: &'b i8) -> Self::Output
[src]
impl<'b, 'a> Div<&'b i8> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the /
operator.
fn div(self, rhs: &'b i8) -> Self::Output
[src]
impl Div<BoundedStruct> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the /
operator.
fn div(self, rhs: BoundedStruct) -> Self::Output
[src]
impl<'a> Div<BoundedStruct> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the /
operator.
fn div(self, rhs: BoundedStruct) -> Self::Output
[src]
impl Div<i8> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the /
operator.
fn div(self, rhs: i8) -> Self::Output
[src]
impl<'a> Div<i8> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the /
operator.
fn div(self, rhs: i8) -> Self::Output
[src]
impl<'a> DivAssign<&'a BoundedStruct> for BoundedStruct
[src]
fn div_assign(&mut self, rhs: &'a BoundedStruct)
[src]
impl<'a> DivAssign<&'a i8> for BoundedStruct
[src]
fn div_assign(&mut self, rhs: &'a i8)
[src]
impl DivAssign<BoundedStruct> for BoundedStruct
[src]
fn div_assign(&mut self, rhs: BoundedStruct)
[src]
impl DivAssign<i8> for BoundedStruct
[src]
fn div_assign(&mut self, rhs: i8)
[src]
impl Eq for BoundedStruct
[src]
impl Hash for BoundedStruct
[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 BoundedStruct
[src]
impl LowerHex for BoundedStruct
[src]
impl<'b> Mul<&'b BoundedStruct> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b BoundedStruct) -> Self::Output
[src]
impl<'b, 'a> Mul<&'b BoundedStruct> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b BoundedStruct) -> Self::Output
[src]
impl<'b> Mul<&'b i8> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b i8) -> Self::Output
[src]
impl<'b, 'a> Mul<&'b i8> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b i8) -> Self::Output
[src]
impl Mul<BoundedStruct> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the *
operator.
fn mul(self, rhs: BoundedStruct) -> Self::Output
[src]
impl<'a> Mul<BoundedStruct> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the *
operator.
fn mul(self, rhs: BoundedStruct) -> Self::Output
[src]
impl Mul<i8> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the *
operator.
fn mul(self, rhs: i8) -> Self::Output
[src]
impl<'a> Mul<i8> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the *
operator.
fn mul(self, rhs: i8) -> Self::Output
[src]
impl<'a> MulAssign<&'a BoundedStruct> for BoundedStruct
[src]
fn mul_assign(&mut self, rhs: &'a BoundedStruct)
[src]
impl<'a> MulAssign<&'a i8> for BoundedStruct
[src]
fn mul_assign(&mut self, rhs: &'a i8)
[src]
impl MulAssign<BoundedStruct> for BoundedStruct
[src]
fn mul_assign(&mut self, rhs: BoundedStruct)
[src]
impl MulAssign<i8> for BoundedStruct
[src]
fn mul_assign(&mut self, rhs: i8)
[src]
impl Neg for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl<'a> Neg for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl Octal for BoundedStruct
[src]
impl Ord for BoundedStruct
[src]
fn cmp(&self, other: &BoundedStruct) -> 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<BoundedStruct> for BoundedStruct
[src]
fn eq(&self, other: &BoundedStruct) -> bool
[src]
fn ne(&self, other: &BoundedStruct) -> bool
[src]
impl PartialOrd<BoundedStruct> for BoundedStruct
[src]
fn partial_cmp(&self, other: &BoundedStruct) -> Option<Ordering>
[src]
fn lt(&self, other: &BoundedStruct) -> bool
[src]
fn le(&self, other: &BoundedStruct) -> bool
[src]
fn gt(&self, other: &BoundedStruct) -> bool
[src]
fn ge(&self, other: &BoundedStruct) -> bool
[src]
impl<'b> Rem<&'b BoundedStruct> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the %
operator.
fn rem(self, rhs: &'b BoundedStruct) -> Self::Output
[src]
impl<'b, 'a> Rem<&'b BoundedStruct> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the %
operator.
fn rem(self, rhs: &'b BoundedStruct) -> Self::Output
[src]
impl<'b> Rem<&'b i8> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the %
operator.
fn rem(self, rhs: &'b i8) -> Self::Output
[src]
impl<'b, 'a> Rem<&'b i8> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the %
operator.
fn rem(self, rhs: &'b i8) -> Self::Output
[src]
impl Rem<BoundedStruct> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the %
operator.
fn rem(self, rhs: BoundedStruct) -> Self::Output
[src]
impl<'a> Rem<BoundedStruct> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the %
operator.
fn rem(self, rhs: BoundedStruct) -> Self::Output
[src]
impl Rem<i8> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the %
operator.
fn rem(self, rhs: i8) -> Self::Output
[src]
impl<'a> Rem<i8> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the %
operator.
fn rem(self, rhs: i8) -> Self::Output
[src]
impl<'a> RemAssign<&'a BoundedStruct> for BoundedStruct
[src]
fn rem_assign(&mut self, rhs: &'a BoundedStruct)
[src]
impl<'a> RemAssign<&'a i8> for BoundedStruct
[src]
fn rem_assign(&mut self, rhs: &'a i8)
[src]
impl RemAssign<BoundedStruct> for BoundedStruct
[src]
fn rem_assign(&mut self, rhs: BoundedStruct)
[src]
impl RemAssign<i8> for BoundedStruct
[src]
fn rem_assign(&mut self, rhs: i8)
[src]
impl StructuralEq for BoundedStruct
[src]
impl StructuralPartialEq for BoundedStruct
[src]
impl<'b> Sub<&'b BoundedStruct> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the -
operator.
fn sub(self, rhs: &'b BoundedStruct) -> Self::Output
[src]
impl<'b, 'a> Sub<&'b BoundedStruct> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the -
operator.
fn sub(self, rhs: &'b BoundedStruct) -> Self::Output
[src]
impl<'b> Sub<&'b i8> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the -
operator.
fn sub(self, rhs: &'b i8) -> Self::Output
[src]
impl<'b, 'a> Sub<&'b i8> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the -
operator.
fn sub(self, rhs: &'b i8) -> Self::Output
[src]
impl Sub<BoundedStruct> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the -
operator.
fn sub(self, rhs: BoundedStruct) -> Self::Output
[src]
impl<'a> Sub<BoundedStruct> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the -
operator.
fn sub(self, rhs: BoundedStruct) -> Self::Output
[src]
impl Sub<i8> for BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the -
operator.
fn sub(self, rhs: i8) -> Self::Output
[src]
impl<'a> Sub<i8> for &'a BoundedStruct
[src]
type Output = BoundedStruct
The resulting type after applying the -
operator.
fn sub(self, rhs: i8) -> Self::Output
[src]
impl<'a> SubAssign<&'a BoundedStruct> for BoundedStruct
[src]
fn sub_assign(&mut self, rhs: &'a BoundedStruct)
[src]
impl<'a> SubAssign<&'a i8> for BoundedStruct
[src]
fn sub_assign(&mut self, rhs: &'a i8)
[src]
impl SubAssign<BoundedStruct> for BoundedStruct
[src]
fn sub_assign(&mut self, rhs: BoundedStruct)
[src]
impl SubAssign<i8> for BoundedStruct
[src]
fn sub_assign(&mut self, rhs: i8)
[src]
impl UpperExp for BoundedStruct
[src]
impl UpperHex for BoundedStruct
[src]
Auto Trait Implementations
impl RefUnwindSafe for BoundedStruct
impl Send for BoundedStruct
impl Sync for BoundedStruct
impl Unpin for BoundedStruct
impl UnwindSafe for BoundedStruct
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>,