[−]Trait chain::bigint::uint::Uint
Large, fixed-length unsigned integer type.
Required Methods
fn zero() -> Self
[−]
Returns new instance equalling zero.
fn one() -> Self
[−]
Returns new instance equalling one.
fn max_value() -> Self
[−]
Returns the largest value that can be represented by this integer type.
fn from_dec_str(value: &str) -> Result<Self, FromDecStrErr>
[−]
Convert from a decimal string.
fn low_u32(&self) -> u32
[−]
Conversion to u32
fn low_u64(&self) -> u64
[−]
Conversion to u64
fn as_u32(&self) -> u32
[−]
Conversion to u32 with overflow checking
fn as_u64(&self) -> u64
[−]
Conversion to u64 with overflow checking
fn bits(&self) -> usize
[−]
Return the least number of bits needed to represent the number
fn bit(&self, index: usize) -> bool
[−]
Return if specific bit is set
fn byte(&self, index: usize) -> u8
[−]
Return single byte
fn to_big_endian(&self, bytes: &mut [u8])
[−]
Convert to the sequence of bytes with a big endian
fn to_little_endian(&self, result: &mut [u8])
[−]
Convert to the sequence of bytes with a little endian
fn to_hex(&self) -> String
[−]
Convert to a non-zero-prefixed hex representation (not prefixed by 0x
).
fn exp10(n: usize) -> Self
[−]
Create Uint(10**n)
fn pow(self, other: Self) -> Self
[−]
Return eponentation self**other
. Panic on overflow.
fn overflowing_pow(self, other: Self) -> (Self, bool)
[−]
Return wrapped eponentation self**other
and flag if there was an overflow
fn overflowing_add(self, other: Self) -> (Self, bool)
[−]
Add this Uint
to other returning result and possible overflow
fn overflowing_sub(self, other: Self) -> (Self, bool)
[−]
Subtract another Uint
from this returning result and possible overflow
fn overflowing_mul(self, other: Self) -> (Self, bool)
[−]
Multiple this Uint
with other returning result and possible overflow
fn overflowing_div(self, other: Self) -> (Self, bool)
[−]
Divide this Uint
by other returning result and possible overflow
fn overflowing_rem(self, other: Self) -> (Self, bool)
[−]
Returns reminder of division of this Uint
by other and possible overflow
fn overflowing_neg(self) -> (Self, bool)
[−]
Returns negation of this Uint
and overflow (always true)
fn is_zero(&self) -> bool
[−]
Returns
Implementors
impl Uint for U128
[−]
impl Uint for U128
fn from_dec_str(value: &str) -> Result<U128, FromDecStrErr>
fn from_dec_str(value: &str) -> Result<U128, FromDecStrErr>
fn low_u32(&self) -> u32
fn low_u32(&self) -> u32
fn low_u64(&self) -> u64
fn low_u64(&self) -> u64
fn as_u32(&self) -> u32
[−]
fn as_u32(&self) -> u32
Conversion to u32 with overflow checking
fn as_u64(&self) -> u64
[−]
fn as_u64(&self) -> u64
Conversion to u64 with overflow checking
fn is_zero(&self) -> bool
fn is_zero(&self) -> bool
fn bits(&self) -> usize
[−]
fn bits(&self) -> usize
Return the least number of bits needed to represent the number
fn bit(&self, index: usize) -> bool
fn bit(&self, index: usize) -> bool
fn byte(&self, index: usize) -> u8
fn byte(&self, index: usize) -> u8
fn to_big_endian(&self, bytes: &mut [u8])
fn to_big_endian(&self, bytes: &mut [u8])
fn to_little_endian(&self, bytes: &mut [u8])
fn to_little_endian(&self, bytes: &mut [u8])
fn to_hex(&self) -> String
fn to_hex(&self) -> String
fn exp10(n: usize) -> U128
fn exp10(n: usize) -> U128
fn zero() -> U128
fn zero() -> U128
fn one() -> U128
fn one() -> U128
fn max_value() -> U128
fn max_value() -> U128
fn pow(self, expon: U128) -> U128
[−]
fn pow(self, expon: U128) -> U128
Fast exponentation by squaring https://en.wikipedia.org/wiki/Exponentiation_by_squaring
fn overflowing_pow(self, expon: U128) -> (U128, bool)
[−]
fn overflowing_pow(self, expon: U128) -> (U128, bool)
Fast exponentation by squaring https://en.wikipedia.org/wiki/Exponentiation_by_squaring
fn overflowing_add(self, other: U128) -> (U128, bool)
[−]
fn overflowing_add(self, other: U128) -> (U128, bool)
Optimized instructions
fn overflowing_sub(self, other: U128) -> (U128, bool)
fn overflowing_sub(self, other: U128) -> (U128, bool)
fn overflowing_mul(self, other: U128) -> (U128, bool)
fn overflowing_mul(self, other: U128) -> (U128, bool)
fn overflowing_div(self, other: U128) -> (U128, bool)
fn overflowing_div(self, other: U128) -> (U128, bool)
fn overflowing_rem(self, other: U128) -> (U128, bool)
fn overflowing_rem(self, other: U128) -> (U128, bool)
fn overflowing_neg(self) -> (U128, bool)
fn overflowing_neg(self) -> (U128, bool)
impl Uint for U256
[−]
impl Uint for U256
fn from_dec_str(value: &str) -> Result<U256, FromDecStrErr>
fn from_dec_str(value: &str) -> Result<U256, FromDecStrErr>
fn low_u32(&self) -> u32
fn low_u32(&self) -> u32
fn low_u64(&self) -> u64
fn low_u64(&self) -> u64
fn as_u32(&self) -> u32
[−]
fn as_u32(&self) -> u32
Conversion to u32 with overflow checking
fn as_u64(&self) -> u64
[−]
fn as_u64(&self) -> u64
Conversion to u64 with overflow checking
fn is_zero(&self) -> bool
fn is_zero(&self) -> bool
fn bits(&self) -> usize
[−]
fn bits(&self) -> usize
Return the least number of bits needed to represent the number
fn bit(&self, index: usize) -> bool
fn bit(&self, index: usize) -> bool
fn byte(&self, index: usize) -> u8
fn byte(&self, index: usize) -> u8
fn to_big_endian(&self, bytes: &mut [u8])
fn to_big_endian(&self, bytes: &mut [u8])
fn to_little_endian(&self, bytes: &mut [u8])
fn to_little_endian(&self, bytes: &mut [u8])
fn to_hex(&self) -> String
fn to_hex(&self) -> String
fn exp10(n: usize) -> U256
fn exp10(n: usize) -> U256
fn zero() -> U256
fn zero() -> U256
fn one() -> U256
fn one() -> U256
fn max_value() -> U256
fn max_value() -> U256
fn pow(self, expon: U256) -> U256
[−]
fn pow(self, expon: U256) -> U256
Fast exponentation by squaring https://en.wikipedia.org/wiki/Exponentiation_by_squaring
fn overflowing_pow(self, expon: U256) -> (U256, bool)
[−]
fn overflowing_pow(self, expon: U256) -> (U256, bool)
Fast exponentation by squaring https://en.wikipedia.org/wiki/Exponentiation_by_squaring
fn overflowing_add(self, other: U256) -> (U256, bool)
[−]
fn overflowing_add(self, other: U256) -> (U256, bool)
Optimized instructions
fn overflowing_sub(self, other: U256) -> (U256, bool)
fn overflowing_sub(self, other: U256) -> (U256, bool)
fn overflowing_mul(self, other: U256) -> (U256, bool)
fn overflowing_mul(self, other: U256) -> (U256, bool)
fn overflowing_div(self, other: U256) -> (U256, bool)
fn overflowing_div(self, other: U256) -> (U256, bool)
fn overflowing_rem(self, other: U256) -> (U256, bool)
fn overflowing_rem(self, other: U256) -> (U256, bool)
fn overflowing_neg(self) -> (U256, bool)
fn overflowing_neg(self) -> (U256, bool)
impl Uint for U512
[−]
impl Uint for U512
fn from_dec_str(value: &str) -> Result<U512, FromDecStrErr>
fn from_dec_str(value: &str) -> Result<U512, FromDecStrErr>
fn low_u32(&self) -> u32
fn low_u32(&self) -> u32
fn low_u64(&self) -> u64
fn low_u64(&self) -> u64
fn as_u32(&self) -> u32
[−]
fn as_u32(&self) -> u32
Conversion to u32 with overflow checking
fn as_u64(&self) -> u64
[−]
fn as_u64(&self) -> u64
Conversion to u64 with overflow checking
fn is_zero(&self) -> bool
fn is_zero(&self) -> bool
fn bits(&self) -> usize
[−]
fn bits(&self) -> usize
Return the least number of bits needed to represent the number
fn bit(&self, index: usize) -> bool
fn bit(&self, index: usize) -> bool
fn byte(&self, index: usize) -> u8
fn byte(&self, index: usize) -> u8
fn to_big_endian(&self, bytes: &mut [u8])
fn to_big_endian(&self, bytes: &mut [u8])
fn to_little_endian(&self, bytes: &mut [u8])
fn to_little_endian(&self, bytes: &mut [u8])
fn to_hex(&self) -> String
fn to_hex(&self) -> String
fn exp10(n: usize) -> U512
fn exp10(n: usize) -> U512
fn zero() -> U512
fn zero() -> U512
fn one() -> U512
fn one() -> U512
fn max_value() -> U512
fn max_value() -> U512
fn pow(self, expon: U512) -> U512
[−]
fn pow(self, expon: U512) -> U512
Fast exponentation by squaring https://en.wikipedia.org/wiki/Exponentiation_by_squaring
fn overflowing_pow(self, expon: U512) -> (U512, bool)
[−]
fn overflowing_pow(self, expon: U512) -> (U512, bool)
Fast exponentation by squaring https://en.wikipedia.org/wiki/Exponentiation_by_squaring
fn overflowing_add(self, other: U512) -> (U512, bool)
[−]
fn overflowing_add(self, other: U512) -> (U512, bool)
Optimized instructions
fn overflowing_sub(self, other: U512) -> (U512, bool)
fn overflowing_sub(self, other: U512) -> (U512, bool)
fn overflowing_mul(self, other: U512) -> (U512, bool)
fn overflowing_mul(self, other: U512) -> (U512, bool)
fn overflowing_div(self, other: U512) -> (U512, bool)
fn overflowing_div(self, other: U512) -> (U512, bool)
fn overflowing_rem(self, other: U512) -> (U512, bool)
fn overflowing_rem(self, other: U512) -> (U512, bool)
fn overflowing_neg(self) -> (U512, bool)
fn overflowing_neg(self) -> (U512, bool)