pub struct Uint320(pub [u64; 5]);Expand description
Little-endian large integer type
Tuple Fields§
§0: [u64; 5]Implementations§
Source§impl Uint320
impl Uint320
pub const ZERO: Self
pub const MIN: Self = Self::ZERO
pub const MAX: Self
pub const BITS: u32 = 320u32
pub const BYTES: usize = 40usize
pub const LIMBS: usize = 5usize
pub fn from_u64(n: u64) -> Self
pub fn from_u128(n: u128) -> Self
pub fn as_u128(self) -> u128
pub fn as_u64(self) -> u64
pub fn is_zero(self) -> bool
pub fn leading_zeros(&self) -> u32
pub fn overflowing_shl(self, s: u32) -> (Self, bool)
pub fn wrapping_shl(self, s: u32) -> Self
pub fn overflowing_shr(self, s: u32) -> (Self, bool)
pub fn overflowing_add(self, other: Self) -> (Self, bool)
pub fn overflowing_add_u64(self, other: u64) -> (Self, bool)
pub fn overflowing_sub(self, other: Self) -> (Self, bool)
Sourcepub fn overflowing_mul_u64(self, other: u64) -> (Self, bool)
pub fn overflowing_mul_u64(self, other: u64) -> (Self, bool)
Multiplication by u64
pub fn carrying_mul_u64(self, other: u64) -> (Self, u64)
pub fn overflowing_mul(self, other: Self) -> (Self, bool)
Sourcepub fn from_le_bytes(bytes: [u8; 40]) -> Self
pub fn from_le_bytes(bytes: [u8; 40]) -> Self
Creates big integer value from a byte slice using little-endian encoding
Sourcepub fn from_be_bytes(bytes: [u8; 40]) -> Self
pub fn from_be_bytes(bytes: [u8; 40]) -> Self
Creates big integer value from a byte slice using big-endian encoding
Sourcepub fn to_le_bytes(self) -> [u8; 40]
pub fn to_le_bytes(self) -> [u8; 40]
Convert’s the Uint into little endian byte array
Sourcepub fn to_be_bytes(self) -> [u8; 40]
pub fn to_be_bytes(self) -> [u8; 40]
Convert’s the Uint into big endian byte array
pub fn to_be_bytes_var(self) -> Vec<u8> ⓘ
pub fn div_rem_u64(self, other: u64) -> (Self, u64)
pub fn as_f64(&self) -> f64
pub fn div_rem(self, other: Self) -> (Self, Self)
Sourcepub fn mod_inverse(self, prime: Self) -> Option<Self>
pub fn mod_inverse(self, prime: Self) -> Option<Self>
Assumes self < prime
pub fn iter_be_bits(self) -> impl ExactSizeIterator<Item = bool> + FusedIterator
Sourcepub fn from_hex(hex: &str) -> Result<Self, Error>
pub fn from_hex(hex: &str) -> Result<Self, Error>
Converts a Self::BYTES*2 hex string interpreted as big endian, into a Uint
pub fn from_be_bytes_var(bytes: &[u8]) -> Result<Self, TryFromSliceError>
pub fn as_bigint(&self) -> Result<BigInt, Error>
pub fn to_bigint(self) -> Result<BigInt, Error>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Uint320
impl<'de> Deserialize<'de> for Uint320
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl MemSizeEstimator for Uint320
impl MemSizeEstimator for Uint320
Source§fn estimate_mem_units(&self) -> usize
fn estimate_mem_units(&self) -> usize
Estimates the number of units this object holds in memory where the unit byte size is usually
a constant known to the caller as well (and hence we avoid computing it over and over)
Source§fn estimate_size(&self, mem_mode: MemMode) -> usize
fn estimate_size(&self, mem_mode: MemMode) -> usize
Estimates the size of this object depending on the passed mem mode
Source§fn estimate_mem_bytes(&self) -> usize
fn estimate_mem_bytes(&self) -> usize
Estimates the (deep) size of this object in bytes (including heap owned inner data)
Source§impl Ord for Uint320
impl Ord for Uint320
Source§impl PartialOrd<u128> for Uint320
impl PartialOrd<u128> for Uint320
Source§impl PartialOrd<u64> for Uint320
impl PartialOrd<u64> for Uint320
Source§impl PartialOrd for Uint320
impl PartialOrd for Uint320
impl Copy for Uint320
impl Eq for Uint320
impl StructuralPartialEq for Uint320
Auto Trait Implementations§
impl Freeze for Uint320
impl RefUnwindSafe for Uint320
impl Send for Uint320
impl Sync for Uint320
impl Unpin for Uint320
impl UnwindSafe for Uint320
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more