Struct substrate_bn::arith::U256 [−][src]
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 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]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]
pub fn max(self, other: Self) -> Self#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]
pub fn min(self, other: Self) -> Self#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
#[must_use]
pub fn clamp(self, min: Self, max: Self) -> Selfimpl PartialEq<U256> for U256
[src]
impl PartialOrd<U256> for U256
[src]
fn partial_cmp(&self, other: &U256) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
pub fn le(&self, other: &Rhs) -> bool#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
pub fn ge(&self, other: &Rhs) -> boolimpl 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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,