[−][src]Struct substrate_bn::arith::U256
256-bit, stack allocated biginteger for use in prime field arithmetic.
Implementations
impl U256[src]
pub fn from_slice(s: &[u8]) -> Result<U256, Error>[src]
Initialize U256 from slice of bytes (big endian)
pub fn to_big_endian(&self, s: &mut [u8]) -> Result<(), Error>[src]
pub fn zero() -> U256[src]
pub fn one() -> U256[src]
pub fn random<R: Rng>(rng: &mut R, modulo: &U256) -> U256[src]
Produce a random number (mod modulo)
pub fn is_zero(&self) -> bool[src]
pub fn set_bit(&mut self, n: usize, to: bool) -> bool[src]
pub fn get_bit(&self, n: usize) -> Option<bool>[src]
pub fn add(&mut self, other: &U256, modulo: &U256)[src]
Add other to self (mod modulo)
pub fn sub(&mut self, other: &U256, modulo: &U256)[src]
Subtract other from self (mod modulo)
pub fn mul(&mut self, other: &U256, modulo: &U256, inv: u128)[src]
Multiply self by other (mod modulo) via the Montgomery
multiplication method.
pub fn neg(&mut self, modulo: &U256)[src]
Turn self into its additive inverse (mod modulo)
pub fn is_even(&self) -> bool[src]
pub fn invert(&mut self, modulo: &U256)[src]
Turn self into its multiplicative inverse (mod modulo)
pub fn bits(&self) -> BitIterator<'_>ⓘNotable traits for BitIterator<'a>
impl<'a> Iterator for BitIterator<'a> type Item = bool;[src]
Notable traits for BitIterator<'a>
impl<'a> Iterator for BitIterator<'a> type Item = bool;Return an Iterator<Item=bool> over all bits from MSB to LSB.
Trait Implementations
impl Clone for U256[src]
impl Copy for U256[src]
impl Debug for U256[src]
impl Decodable for U256[src]
impl Encodable for U256[src]
impl Eq for U256[src]
impl From<[u64; 4]> for U256[src]
impl From<u64> for U256[src]
impl Ord for U256[src]
fn cmp(&self, other: &U256) -> Ordering[src]
#[must_use]fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self[src]
impl PartialEq<U256> for U256[src]
impl PartialOrd<U256> for U256[src]
fn partial_cmp(&self, other: &U256) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl StructuralEq for U256[src]
impl StructuralPartialEq for U256[src]
Auto Trait Implementations
impl RefUnwindSafe for U256
impl Send for U256
impl Sync for U256
impl Unpin for U256
impl UnwindSafe for U256
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,