[][src]Trait ff_uint::Uint

pub trait Uint: Sized + Clone + Copy + Default + PartialEq + Eq + PartialOrd + Ord + Add<Self, Output = Self> + Sub<Self, Output = Self> + Mul<Self, Output = Self> + Mul<u64, Output = Self> + Div<Self, Output = Self> + Rem<Self, Output = Self> + Shl<u32, Output = Self> + Shr<u32, Output = Self> + AddAssign<Self> + SubAssign<Self> + MulAssign<Self> + MulAssign<u64> + DivAssign<Self> + RemAssign<Self> + Not<Output = Self> + BitAnd<Self, Output = Self> + BitOr<Self, Output = Self> + BitXor<Self, Output = Self> + BitAndAssign<Self> + BitOrAssign<Self> + ShlAssign<u32> + ShrAssign<u32> + From<bool> + From<u8> + From<u16> + From<u32> + From<u64> + From<u128> + From<i8> + From<i16> + From<i32> + From<i64> + From<i128> + TryInto<bool> + TryInto<u8> + TryInto<u16> + TryInto<u32> + TryInto<u64> + TryInto<u128> + TryInto<i8> + TryInto<i16> + TryInto<i32> + TryInto<i64> + TryInto<i128> + Hash + Debug + Display + FromStr + LowerHex + From<&'static str> + BorshSerialize + BorshDeserialize {
    type Inner: AsMut<[u64]> + AsRef<[u64]> + Copy + Clone + Default + Sized;

    const MAX: Self;
    const ZERO: Self;
    const ONE: Self;
    const NUM_WORDS: usize;
    const WORD_BITS: usize;

    fn random<R: Rng + ?Sized>(rng: &mut R) -> Self;
fn into_inner(self) -> Self::Inner;
fn as_inner(&self) -> &Self::Inner;
fn as_inner_mut(&mut self) -> &mut Self::Inner;
fn put_big_endian(&self, bytes: &mut [u8]);
fn put_little_endian(&self, bytes: &mut [u8]);
fn to_big_endian(&self) -> Vec<u8>;
fn to_little_endian(&self) -> Vec<u8>;
fn from_big_endian(slice: &[u8]) -> Self;
fn from_little_endian(slice: &[u8]) -> Self;
fn as_u64(&self) -> u64;
fn low_u64(&self) -> u64;
fn from_u64(v: u64) -> Self;
fn is_zero(&self) -> bool;
fn bits(&self) -> usize;
fn leading_zeros(&self) -> u32;
fn trailing_zeros(&self) -> u32;
fn div_mod(self, other: Self) -> (Self, Self);
fn overflowing_add(self, other: Self) -> (Self, bool);
fn overflowing_sub(self, other: Self) -> (Self, bool);
fn overflowing_mul_u64(self, other: u64) -> (Self, u64);
fn overflowing_mul(self, other: Self) -> (Self, bool);
fn overflowing_not(self) -> (Self, bool);
fn overflowing_bitand(self, other: Self) -> (Self, bool);
fn overflowing_bitor(self, other: Self) -> (Self, bool);
fn overflowing_bitxor(self, other: Self) -> (Self, bool);
fn overflowing_neg(self) -> (Self, bool);
fn overflowing_shr(self, other: u32) -> (Self, bool);
fn overflowing_shl(self, other: u32) -> (Self, bool);
fn wrapping_cmp(&self, other: &Self) -> Ordering; fn max_value() -> Self { ... }
fn min_value() -> Self { ... }
fn is_even(&self) -> bool { ... }
fn is_odd(&self) -> bool { ... }
fn bit(&self, n: usize) -> bool { ... }
fn overflowing_pow<S: BitIterBE>(self, exp: S) -> (Self, bool) { ... }
fn to_other<U: Uint>(self) -> Option<U> { ... }
fn wrapping_pow(self, other: Self) -> Self { ... }
fn checked_pow(self, expon: Self) -> Option<Self> { ... }
fn saturating_pow(self, other: Self) -> Self { ... }
fn wrapping_add(self, other: Self) -> Self { ... }
fn saturating_add(self, other: Self) -> Self { ... }
fn checked_add(self, other: Self) -> Option<Self> { ... }
fn wrapping_sub(self, other: Self) -> Self { ... }
fn saturating_sub(self, other: Self) -> Self { ... }
fn checked_sub(self, other: Self) -> Option<Self> { ... }
fn wrapping_mul(self, other: Self) -> Self { ... }
fn saturating_mul(self, other: Self) -> Self { ... }
fn checked_mul(self, other: Self) -> Option<Self> { ... }
fn checked_div(self, other: Self) -> Option<Self> { ... }
fn overflowing_div(self, other: Self) -> (Self, bool) { ... }
fn wrapping_div(self, other: Self) -> Self { ... }
fn checked_rem(self, other: Self) -> Option<Self> { ... }
fn overflowing_rem(self, other: Self) -> (Self, bool) { ... }
fn wrapping_rem(self, other: Self) -> Self { ... }
fn wrapping_neg(self) -> Self { ... }
fn checked_neg(self) -> Option<Self> { ... }
fn wrapping_shr(self, rhs: u32) -> Self { ... }
fn checked_shr(self, rhs: u32) -> Option<Self> { ... }
fn wrapping_shl(self, lhs: u32) -> Self { ... }
fn checked_shl(self, lhs: u32) -> Option<Self> { ... } }

Associated Types

Loading content...

Associated Constants

const MAX: Self

const ZERO: Self

const ONE: Self

const NUM_WORDS: usize

const WORD_BITS: usize

Loading content...

Required methods

fn random<R: Rng + ?Sized>(rng: &mut R) -> Self

fn into_inner(self) -> Self::Inner

fn as_inner(&self) -> &Self::Inner

fn as_inner_mut(&mut self) -> &mut Self::Inner

fn put_big_endian(&self, bytes: &mut [u8])

fn put_little_endian(&self, bytes: &mut [u8])

fn to_big_endian(&self) -> Vec<u8>

fn to_little_endian(&self) -> Vec<u8>

fn from_big_endian(slice: &[u8]) -> Self

fn from_little_endian(slice: &[u8]) -> Self

fn as_u64(&self) -> u64

fn low_u64(&self) -> u64

fn from_u64(v: u64) -> Self

fn is_zero(&self) -> bool

fn bits(&self) -> usize

fn leading_zeros(&self) -> u32

fn trailing_zeros(&self) -> u32

fn div_mod(self, other: Self) -> (Self, Self)

fn overflowing_add(self, other: Self) -> (Self, bool)

fn overflowing_sub(self, other: Self) -> (Self, bool)

fn overflowing_mul_u64(self, other: u64) -> (Self, u64)

fn overflowing_mul(self, other: Self) -> (Self, bool)

fn overflowing_not(self) -> (Self, bool)

fn overflowing_bitand(self, other: Self) -> (Self, bool)

fn overflowing_bitor(self, other: Self) -> (Self, bool)

fn overflowing_bitxor(self, other: Self) -> (Self, bool)

fn overflowing_neg(self) -> (Self, bool)

fn overflowing_shr(self, other: u32) -> (Self, bool)

fn overflowing_shl(self, other: u32) -> (Self, bool)

fn wrapping_cmp(&self, other: &Self) -> Ordering

Loading content...

Provided methods

fn max_value() -> Self

fn min_value() -> Self

fn is_even(&self) -> bool

fn is_odd(&self) -> bool

fn bit(&self, n: usize) -> bool

fn overflowing_pow<S: BitIterBE>(self, exp: S) -> (Self, bool)

fn to_other<U: Uint>(self) -> Option<U>

fn wrapping_pow(self, other: Self) -> Self

fn checked_pow(self, expon: Self) -> Option<Self>

fn saturating_pow(self, other: Self) -> Self

fn wrapping_add(self, other: Self) -> Self

fn saturating_add(self, other: Self) -> Self

fn checked_add(self, other: Self) -> Option<Self>

fn wrapping_sub(self, other: Self) -> Self

fn saturating_sub(self, other: Self) -> Self

fn checked_sub(self, other: Self) -> Option<Self>

fn wrapping_mul(self, other: Self) -> Self

fn saturating_mul(self, other: Self) -> Self

fn checked_mul(self, other: Self) -> Option<Self>

fn checked_div(self, other: Self) -> Option<Self>

fn overflowing_div(self, other: Self) -> (Self, bool)

Checked division. Returns None if other == 0.

fn wrapping_div(self, other: Self) -> Self

fn checked_rem(self, other: Self) -> Option<Self>

Checked modulus. Returns None if other == 0.

fn overflowing_rem(self, other: Self) -> (Self, bool)

fn wrapping_rem(self, other: Self) -> Self

fn wrapping_neg(self) -> Self

fn checked_neg(self) -> Option<Self>

Checked negation. Returns None unless self == 0.

fn wrapping_shr(self, rhs: u32) -> Self

fn checked_shr(self, rhs: u32) -> Option<Self>

fn wrapping_shl(self, lhs: u32) -> Self

fn checked_shl(self, lhs: u32) -> Option<Self>

Loading content...

Implementors

Loading content...