Expand description
256-bit, stack allocated biginteger for use in prime field arithmetic.
Tuple Fields
0: [u64; 4]
Implementations
sourceimpl U256
impl U256
pub fn zero() -> U256
pub fn one() -> U256
pub fn into_bytes(&self) -> Vec<u8>
pub fn is_zero(&self) -> bool
pub fn set_bit(&mut self, n: usize, to: bool) -> bool
pub fn get_bit(&self, n: usize) -> Option<bool>
sourcepub fn mul(&mut self, other: &U256, modulo: &U256, inv: u64)
pub fn mul(&mut self, other: &U256, modulo: &U256, inv: u64)
Multiply self
by other
(mod modulo
) via the Montgomery
multiplication method.
pub fn is_even(&self) -> bool
sourcepub fn bits(&self) -> BitIterator<'_>ⓘNotable traits for BitIterator<'a>impl<'a> Iterator for BitIterator<'a> type Item = bool;
pub fn bits(&self) -> BitIterator<'_>ⓘ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
sourceimpl<'de> Deserialize<'de> for U256
impl<'de> Deserialize<'de> for U256
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Ord for U256
impl Ord for U256
sourceimpl PartialOrd<U256> for U256
impl PartialOrd<U256> for U256
sourcefn partial_cmp(&self, other: &U256) -> Option<Ordering>
fn partial_cmp(&self, other: &U256) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for U256
impl Eq for U256
impl StructuralEq for U256
impl StructuralPartialEq for U256
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more