Type Alias NonZeroUint

Source
pub type NonZeroUint = NonZero<Uint>;
Available on crate feature bigint only.
Expand description

Non-zero Uint.

Aliased Type§

pub struct NonZeroUint(/* private fields */);

Implementations

Source§

impl<T> NonZero<T>

Source

pub fn new(n: T) -> CtOption<NonZero<T>>
where T: Zero,

Create a new non-zero integer.

Source

pub const fn as_ref(&self) -> &T

Provides access to the contents of NonZero in a const context.

Source

pub fn get(self) -> T

Returns the inner value.

Source§

impl<T> NonZero<T>
where T: Bounded,

Source

pub const BITS: u32 = T::BITS

Total size of the represented integer in bits.

Source

pub const BYTES: usize = T::BYTES

Total size of the represented integer in bytes.

Source§

impl<T> NonZero<T>
where T: Constants,

Source

pub const ONE: NonZero<T>

The value 1.

Source

pub const MAX: NonZero<T>

Maximum value this integer can express.

Source§

impl<T> NonZero<T>
where T: Encoding + Zero,

Source

pub fn from_be_bytes(bytes: <T as Encoding>::Repr) -> CtOption<NonZero<T>>

Decode from big endian bytes.

Source

pub fn from_le_bytes(bytes: <T as Encoding>::Repr) -> CtOption<NonZero<T>>

Decode from little endian bytes.

Trait Implementations§

Source§

impl TryFrom<&Mpint> for NonZeroUint

Available on crate feature alloc only.
Source§

type Error = Error

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

fn try_from(mpint: &Mpint) -> Result<NonZeroUint>

Performs the conversion.
Source§

impl TryFrom<Mpint> for NonZeroUint

Available on crate feature alloc only.
Source§

type Error = Error

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

fn try_from(mpint: Mpint) -> Result<NonZeroUint>

Performs the conversion.
Source§

impl<T> AsRef<T> for NonZero<T>

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

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

Source§

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

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

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

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> ConditionallySelectable for NonZero<T>

Source§

fn conditional_select( a: &NonZero<T>, b: &NonZero<T>, choice: Choice, ) -> NonZero<T>

Select a or b according to choice. Read more
Source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
Source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
Source§

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

Source§

fn ct_eq(&self, other: &NonZero<T>) -> Choice

Determine if two items are equal. Read more
Source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
Source§

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

Source§

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

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

impl<T> Default for NonZero<T>
where T: Constants,

Source§

fn default() -> NonZero<T>

Returns the “default value” for a type. Read more
Source§

impl<T> Deref for NonZero<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

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

Source§

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

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

impl<T> From<Odd<T>> for NonZero<T>

Source§

fn from(odd: Odd<T>) -> NonZero<T>

Converts to this type from the input type.
Source§

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

Source§

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

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> LowerHex for NonZero<T>
where T: LowerHex,

Source§

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

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

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

Source§

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

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

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

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) -> Self
where Self: Sized,

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

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

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

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

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

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

Source§

fn eq(&self, other: &NonZero<T>) -> 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<T> PartialOrd for NonZero<T>
where T: PartialOrd,

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

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

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

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

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

impl Resize for NonZero<BoxedUint>

Source§

type Output = NonZero<BoxedUint>

The result of the resizing.
Source§

fn resize_unchecked( self, at_least_bits_precision: u32, ) -> <NonZero<BoxedUint> as Resize>::Output

Resizes to the minimum storage that fits at_least_bits_precision without checking if the bit size of self is larger than at_least_bits_precision. Read more
Source§

fn try_resize( self, at_least_bits_precision: u32, ) -> Option<<NonZero<BoxedUint> as Resize>::Output>

Resizes to the minimum storage that fits at_least_bits_precision returning None if the bit size of self is larger than at_least_bits_precision. Read more
Source§

fn resize(self, at_least_bits_precision: u32) -> Self::Output

Resizes to the minimum storage that fits at_least_bits_precision panicking if the bit size of self is larger than at_least_bits_precision. Read more
Source§

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

Source§

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

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

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

Source§

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

Source§

impl<T> StructuralPartialEq for NonZero<T>