Trait bigint::uint::Uint
[−]
[src]
pub trait Uint: Sized + Default + FromStr + From<u64> + Debug + Display + PartialOrd + Ord + PartialEq + Eq + Hash { fn zero() -> Self; fn one() -> Self; fn max_value() -> Self; fn from_dec_str(value: &str) -> Result<Self, FromDecStrErr>; fn low_u32(&self) -> u32; fn low_u64(&self) -> u64; fn as_u32(&self) -> u32; fn as_u64(&self) -> u64; fn bits(&self) -> usize; fn bit(&self, index: usize) -> bool; fn byte(&self, index: usize) -> u8; fn to_big_endian(&self, bytes: &mut [u8]); fn to_little_endian(&self, result: &mut [u8]); fn to_hex(&self) -> String; fn exp10(n: usize) -> Self; fn pow(self, other: Self) -> Self; fn overflowing_pow(self, other: Self) -> (Self, bool); fn overflowing_add(self, other: Self) -> (Self, bool); fn overflowing_sub(self, other: Self) -> (Self, bool); fn overflowing_mul(self, other: Self) -> (Self, bool); fn overflowing_div(self, other: Self) -> (Self, bool); fn overflowing_rem(self, other: Self) -> (Self, bool); fn overflowing_neg(self) -> (Self, bool); fn is_zero(&self) -> bool; }
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