pub struct Scalar { /* private fields */ }
Implementations
sourceimpl Scalar
impl Scalar
pub fn from_hex(s: &str) -> Self
pub fn from_be_bytes(v: &[u8]) -> Self
pub fn from_le_bytes(v: &[u8]) -> Self
pub fn to_be_bytes(self) -> [u8; 48]
pub fn to_le_bytes(self) -> [u8; 48]
sourcepub fn comp_eq(self, rhs: Self) -> Self
pub fn comp_eq(self, rhs: Self) -> Self
Produces a new integer which is all ones if the two arguments are equal and
all zeroes otherwise.
NOTE: This is not constant time but BigInt
generally isn’t.
sourcepub fn comp_ne(self, rhs: Self) -> Self
pub fn comp_ne(self, rhs: Self) -> Self
Produces a new integer which is all ones if the first argument is different from
the second argument, and all zeroes otherwise.
NOTE: This is not constant time but BigInt
generally isn’t.
sourcepub fn comp_gte(self, rhs: Self) -> Self
pub fn comp_gte(self, rhs: Self) -> Self
Produces a new integer which is all ones if the first argument is greater than or
equal to the second argument, and all zeroes otherwise.
NOTE: This is not constant time but BigInt
generally isn’t.
sourcepub fn comp_gt(self, rhs: Self) -> Self
pub fn comp_gt(self, rhs: Self) -> Self
Produces a new integer which is all ones if the first argument is strictly greater
than the second argument, and all zeroes otherwise.
NOTE: This is not constant time but BigInt
generally isn’t.
Trait Implementations
sourceimpl Integer for Scalar
impl Integer for Scalar
sourcefn set_bit(self, b: Self, i: usize) -> Self
fn set_bit(self, b: Self, i: usize) -> Self
Set bit i
of this integer to b
and return the result.
Bit b
has to be 0
or 1
.
sourcefn set(self, pos: usize, y: Self, yi: usize) -> Self
fn set(self, pos: usize, y: Self, yi: usize) -> Self
Set bit pos
of this integer to bit yi
of integer y
.
const NUM_BITS: usize = 384usize
fn ZERO() -> Self
fn ONE() -> Self
fn TWO() -> Self
sourcefn from_literal(val: u128) -> Self
fn from_literal(val: u128) -> Self
Get an integer with value val
.
sourcefn from_hex_string(s: &String) -> Self
fn from_hex_string(s: &String) -> Self
Read a hex string (starting with 0x) into an Integer
.
fn rotate_left(self, n: usize) -> Self
fn rotate_right(self, n: usize) -> Self
sourceimpl ModNumeric for Scalar
impl ModNumeric for Scalar
sourcefn signed_modulo(self, n: Self) -> Self
fn signed_modulo(self, n: Self) -> Self
self % n
that always returns a positive integer
sourceimpl Numeric for Scalar
impl Numeric for Scalar
fn wrap_add(self, rhs: Self) -> Self
fn wrap_sub(self, rhs: Self) -> Self
fn wrap_mul(self, rhs: Self) -> Self
fn wrap_div(self, rhs: Self) -> Self
fn equal(self, other: Self) -> bool
fn greater_than(self, other: Self) -> bool
fn greater_than_or_equal(self, other: Self) -> bool
fn less_than(self, other: Self) -> bool
fn less_than_or_equal(self, other: Self) -> bool
fn not_equal_bm(self, other: Self) -> Self
fn equal_bm(self, other: Self) -> Self
fn greater_than_bm(self, other: Self) -> Self
fn greater_than_or_equal_bm(self, other: Self) -> Self
fn less_than_bm(self, other: Self) -> Self
fn less_than_or_equal_bm(self, other: Self) -> Self
sourceimpl Ord for Scalar
impl Ord for Scalar
sourceimpl PartialOrd<Scalar> for Scalar
impl PartialOrd<Scalar> for Scalar
sourcefn partial_cmp(&self, other: &Scalar) -> Option<Ordering>
fn partial_cmp(&self, other: &Scalar) -> 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 Scalar
impl Eq for Scalar
impl NumericCopy for Scalar
impl UnsignedInteger for Scalar
impl UnsignedIntegerCopy for Scalar
Auto Trait Implementations
impl RefUnwindSafe for Scalar
impl Send for Scalar
impl Sync for Scalar
impl Unpin for Scalar
impl UnwindSafe for Scalar
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