Struct beetle_nonzero::NonZero

source ·
pub struct NonZero<T: PrimInt> { /* private fields */ }
Expand description

A wrapper around a primitive non-zero integer like i32 or u32.

Implementations§

source§

impl<T: PrimInt> NonZero<T>

source

pub fn new(value: T) -> Option<Self>

source

pub fn get(&self) -> T

Returns a destructured copy of the NonZero value.

Trait Implementations§

source§

impl<T: PrimInt + Add<Output = T>> Add<NonZero<T>> for NonZero<T>

§

type Output = NonZero<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: NonZero<T>) -> NonZero<T>

Performs the + operation. Read more
source§

impl<T: PrimInt + AddAssign> AddAssign<NonZero<T>> for NonZero<T>

source§

fn add_assign(&mut self, rhs: NonZero<T>)

Performs the += operation. Read more
source§

impl<T: PrimInt + BitAnd<Output = T>> BitAnd<NonZero<T>> for NonZero<T>

§

type Output = NonZero<T>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: NonZero<T>) -> NonZero<T>

Performs the & operation. Read more
source§

impl<T: PrimInt + BitAndAssign> BitAndAssign<NonZero<T>> for NonZero<T>

source§

fn bitand_assign(&mut self, rhs: NonZero<T>)

Performs the &= operation. Read more
source§

impl<T: PrimInt + BitOr<Output = T>> BitOr<NonZero<T>> for NonZero<T>

§

type Output = NonZero<T>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: NonZero<T>) -> NonZero<T>

Performs the | operation. Read more
source§

impl<T: PrimInt + BitOrAssign> BitOrAssign<NonZero<T>> for NonZero<T>

source§

fn bitor_assign(&mut self, rhs: NonZero<T>)

Performs the |= operation. Read more
source§

impl<T: PrimInt + BitXor<Output = T>> BitXor<NonZero<T>> for NonZero<T>

§

type Output = NonZero<T>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: NonZero<T>) -> NonZero<T>

Performs the ^ operation. Read more
source§

impl<T: PrimInt + BitXorAssign> BitXorAssign<NonZero<T>> for NonZero<T>

source§

fn bitxor_assign(&mut self, rhs: NonZero<T>)

Performs the ^= operation. Read more
source§

impl<T: Clone + PrimInt> Clone for NonZero<T>

source§

fn clone(&self) -> NonZero<T>

Returns a copy 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<T: Debug + PrimInt> Debug for NonZero<T>

source§

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

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

impl<T> Display for NonZero<T>where T: Display + PrimInt,

source§

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

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

impl<T: PrimInt> Div<NonZero<T>> for NonZero<T>

§

type Output = NonZero<T>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
source§

impl<T, __RhsT> DivAssign<__RhsT> for NonZero<T>where T: DivAssign<__RhsT> + PrimInt,

source§

fn div_assign(&mut self, rhs: __RhsT)

Performs the /= operation. Read more
source§

impl<T: PrimInt> Mul<NonZero<T>> for NonZero<T>

§

type Output = NonZero<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl<T, __RhsT> MulAssign<__RhsT> for NonZero<T>where T: MulAssign<__RhsT> + PrimInt,

source§

fn mul_assign(&mut self, rhs: __RhsT)

Performs the *= operation. Read more
source§

impl<T: PrimInt> One for NonZero<T>

source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
source§

fn is_one(&self) -> boolwhere Self: PartialEq<Self>,

Returns true if self is equal to the multiplicative identity. Read more
source§

impl<T: Ord + PrimInt> Ord for NonZero<T>

source§

fn cmp(&self, other: &NonZero<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

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

Compares and returns the maximum of two values. Read more
1.21.0 · source§

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

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

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

impl<T: PartialEq + PrimInt> PartialEq<NonZero<T>> for NonZero<T>

source§

fn eq(&self, other: &NonZero<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: PartialOrd + PrimInt> PartialOrd<NonZero<T>> for NonZero<T>

source§

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

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

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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
source§

impl<T, __RhsT> Shl<__RhsT> for NonZero<T>where T: Shl<__RhsT, Output = T> + PrimInt,

§

type Output = NonZero<T>

The resulting type after applying the << operator.
source§

fn shl(self, rhs: __RhsT) -> NonZero<T>

Performs the << operation. Read more
source§

impl<T, __RhsT> ShlAssign<__RhsT> for NonZero<T>where T: ShlAssign<__RhsT> + PrimInt,

source§

fn shl_assign(&mut self, rhs: __RhsT)

Performs the <<= operation. Read more
source§

impl<T, __RhsT> Shr<__RhsT> for NonZero<T>where T: Shr<__RhsT, Output = T> + PrimInt,

§

type Output = NonZero<T>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: __RhsT) -> NonZero<T>

Performs the >> operation. Read more
source§

impl<T, __RhsT> ShrAssign<__RhsT> for NonZero<T>where T: ShrAssign<__RhsT> + PrimInt,

source§

fn shr_assign(&mut self, rhs: __RhsT)

Performs the >>= operation. Read more
source§

impl<T: PrimInt + Sub<Output = T>> Sub<NonZero<T>> for NonZero<T>

§

type Output = NonZero<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: NonZero<T>) -> NonZero<T>

Performs the - operation. Read more
source§

impl<T: PrimInt + SubAssign> SubAssign<NonZero<T>> for NonZero<T>

source§

fn sub_assign(&mut self, rhs: NonZero<T>)

Performs the -= operation. Read more
source§

impl<T: Copy + PrimInt> Copy for NonZero<T>

source§

impl<T: Eq + PrimInt> Eq for NonZero<T>

source§

impl<T: PrimInt> StructuralEq for NonZero<T>

source§

impl<T: PrimInt> StructuralPartialEq for NonZero<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for NonZero<T>where T: RefUnwindSafe,

§

impl<T> Send for NonZero<T>where T: Send,

§

impl<T> Sync for NonZero<T>where T: Sync,

§

impl<T> Unpin for NonZero<T>where T: Unpin,

§

impl<T> UnwindSafe for NonZero<T>where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.