Struct crypto_bigint::NonZero
source · pub struct NonZero<T>(/* private fields */);
Expand description
Wrapper type for non-zero integers.
Implementations§
source§impl<T> NonZero<T>
impl<T> NonZero<T>
sourcepub fn from_be_bytes(bytes: T::Repr) -> CtOption<Self>
pub fn from_be_bytes(bytes: T::Repr) -> CtOption<Self>
Decode from big endian bytes.
sourcepub fn from_le_bytes(bytes: T::Repr) -> CtOption<Self>
pub fn from_le_bytes(bytes: T::Repr) -> CtOption<Self>
Decode from little endian bytes.
source§impl NonZero<Limb>
impl NonZero<Limb>
sourcepub const fn from_u8(n: NonZeroU8) -> Self
pub const fn from_u8(n: NonZeroU8) -> Self
Create a NonZero<Limb>
from a NonZeroU8
(const-friendly)
sourcepub const fn from_u16(n: NonZeroU16) -> Self
pub const fn from_u16(n: NonZeroU16) -> Self
Create a NonZero<Limb>
from a NonZeroU16
(const-friendly)
sourcepub const fn from_u32(n: NonZeroU32) -> Self
pub const fn from_u32(n: NonZeroU32) -> Self
Create a NonZero<Limb>
from a NonZeroU32
(const-friendly)
sourcepub const fn from_u64(n: NonZeroU64) -> Self
Available on 64-bit only.
pub const fn from_u64(n: NonZeroU64) -> Self
Create a NonZero<Limb>
from a NonZeroU64
(const-friendly)
source§impl<const LIMBS: usize> NonZero<Uint<LIMBS>>
impl<const LIMBS: usize> NonZero<Uint<LIMBS>>
sourcepub const fn from_u8(n: NonZeroU8) -> Self
pub const fn from_u8(n: NonZeroU8) -> Self
Create a NonZero<Uint>
from a NonZeroU8
(const-friendly)
sourcepub const fn from_u16(n: NonZeroU16) -> Self
pub const fn from_u16(n: NonZeroU16) -> Self
Create a NonZero<Uint>
from a NonZeroU16
(const-friendly)
sourcepub const fn from_u32(n: NonZeroU32) -> Self
pub const fn from_u32(n: NonZeroU32) -> Self
Create a NonZero<Uint>
from a NonZeroU32
(const-friendly)
sourcepub const fn from_u64(n: NonZeroU64) -> Self
pub const fn from_u64(n: NonZeroU64) -> Self
Create a NonZero<Uint>
from a NonZeroU64
(const-friendly)
sourcepub const fn from_u128(n: NonZeroU128) -> Self
pub const fn from_u128(n: NonZeroU128) -> Self
Create a NonZero<Uint>
from a NonZeroU128
(const-friendly)
source§impl<T> NonZero<T>where
T: ArrayEncoding + Zero,
impl<T> NonZero<T>where
T: ArrayEncoding + Zero,
sourcepub fn from_be_byte_array(bytes: ByteArray<T>) -> CtOption<Self>
Available on crate feature hybrid-array
only.
pub fn from_be_byte_array(bytes: ByteArray<T>) -> CtOption<Self>
hybrid-array
only.Decode a non-zero integer from big endian bytes.
sourcepub fn from_le_byte_array(bytes: ByteArray<T>) -> CtOption<Self>
Available on crate feature hybrid-array
only.
pub fn from_le_byte_array(bytes: ByteArray<T>) -> CtOption<Self>
hybrid-array
only.Decode a non-zero integer from big endian bytes.
Trait Implementations§
source§impl<T> ConditionallySelectable for NonZero<T>where
T: ConditionallySelectable,
impl<T> ConditionallySelectable for NonZero<T>where
T: ConditionallySelectable,
source§impl<T> ConstantTimeEq for NonZero<T>where
T: ConstantTimeEq,
impl<T> ConstantTimeEq for NonZero<T>where
T: ConstantTimeEq,
source§impl<'de, T: Deserialize<'de> + Zero> Deserialize<'de> for NonZero<T>
Available on crate feature serde
only.
impl<'de, T: Deserialize<'de> + Zero> Deserialize<'de> for NonZero<T>
Available on crate feature
serde
only.source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl DivAssign<&NonZero<BoxedUint>> for Wrapping<BoxedUint>
Available on crate feature alloc
only.
impl DivAssign<&NonZero<BoxedUint>> for Wrapping<BoxedUint>
Available on crate feature
alloc
only.source§impl DivAssign<NonZero<BoxedUint>> for Wrapping<BoxedUint>
Available on crate feature alloc
only.
impl DivAssign<NonZero<BoxedUint>> for Wrapping<BoxedUint>
Available on crate feature
alloc
only.source§impl<const LIMBS: usize> From<NonZeroU128> for NonZero<Uint<LIMBS>>
impl<const LIMBS: usize> From<NonZeroU128> for NonZero<Uint<LIMBS>>
source§fn from(integer: NonZeroU128) -> Self
fn from(integer: NonZeroU128) -> Self
Converts to this type from the input type.
source§impl From<NonZeroU16> for NonZero<Limb>
impl From<NonZeroU16> for NonZero<Limb>
source§fn from(integer: NonZeroU16) -> Self
fn from(integer: NonZeroU16) -> Self
Converts to this type from the input type.
source§impl<const LIMBS: usize> From<NonZeroU16> for NonZero<Uint<LIMBS>>
impl<const LIMBS: usize> From<NonZeroU16> for NonZero<Uint<LIMBS>>
source§fn from(integer: NonZeroU16) -> Self
fn from(integer: NonZeroU16) -> Self
Converts to this type from the input type.
source§impl From<NonZeroU32> for NonZero<Limb>
impl From<NonZeroU32> for NonZero<Limb>
source§fn from(integer: NonZeroU32) -> Self
fn from(integer: NonZeroU32) -> Self
Converts to this type from the input type.
source§impl<const LIMBS: usize> From<NonZeroU32> for NonZero<Uint<LIMBS>>
impl<const LIMBS: usize> From<NonZeroU32> for NonZero<Uint<LIMBS>>
source§fn from(integer: NonZeroU32) -> Self
fn from(integer: NonZeroU32) -> Self
Converts to this type from the input type.
source§impl From<NonZeroU64> for NonZero<Limb>
Available on 64-bit only.
impl From<NonZeroU64> for NonZero<Limb>
Available on 64-bit only.
source§fn from(integer: NonZeroU64) -> Self
fn from(integer: NonZeroU64) -> Self
Converts to this type from the input type.
source§impl<const LIMBS: usize> From<NonZeroU64> for NonZero<Uint<LIMBS>>
impl<const LIMBS: usize> From<NonZeroU64> for NonZero<Uint<LIMBS>>
source§fn from(integer: NonZeroU64) -> Self
fn from(integer: NonZeroU64) -> Self
Converts to this type from the input type.
source§impl<T: Ord> Ord for NonZero<T>
impl<T: Ord> Ord for NonZero<T>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T: PartialEq> PartialEq for NonZero<T>
impl<T: PartialEq> PartialEq for NonZero<T>
source§impl<T: PartialOrd> PartialOrd for NonZero<T>
impl<T: PartialOrd> PartialOrd for NonZero<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moresource§impl<T> Random for NonZero<T>
Available on crate feature rand_core
only.
impl<T> Random for NonZero<T>
Available on crate feature
rand_core
only.source§fn random(rng: &mut impl CryptoRngCore) -> Self
fn random(rng: &mut impl CryptoRngCore) -> Self
Generate a random NonZero<T>
.
impl<T: Copy> Copy for NonZero<T>
impl<T: Eq> Eq for NonZero<T>
impl<T> StructuralEq for NonZero<T>
impl<T> 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more