pub trait Elem: Mul<Output = Self> + MulAssign + Add<Output = Self> + AddAssign + Neg + Sub<Output = Self> + SubAssign + PartialEq + Eq + Clone + Copy + Sized + Pod + Default + Clone + Copy + Send + Sync + Debug + 'static {
const INVALID: Self;
const ZERO: Self;
const ONE: Self;
const WORDS: usize;
Show 13 methods
fn inv(self) -> Self;
fn random(rng: &mut impl RngCore) -> Self;
fn from_u64(val: u64) -> Self;
fn to_u32_words(&self) -> Vec<u32>;
fn from_u32_words(val: &[u32]) -> Self;
fn is_valid(&self) -> bool;
fn pow(self, exp: usize) -> Self { ... }
fn valid_or_zero(&self) -> Self { ... }
fn ensure_valid(&self) -> &Self { ... }
fn as_u32_slice(elems: &[Self]) -> &[u32] { ... }
fn as_u32_slice_unchecked(elems: &[Self]) -> &[u32] { ... }
fn from_u32_slice(u32s: &[u32]) -> &[Self] ⓘ { ... }
fn from_u32_slice_unchecked(u32s: &[u32]) -> &[Self] ⓘ { ... }
}
Expand description
Subfield elements that can be compared, copied, and operated on via multiplication, addition, and subtraction
Required Associated Constants§
Required Methods§
sourcefn to_u32_words(&self) -> Vec<u32>
fn to_u32_words(&self) -> Vec<u32>
Represent a field element as a sequence of u32s
sourcefn from_u32_words(val: &[u32]) -> Self
fn from_u32_words(val: &[u32]) -> Self
Interpret a sequence of u32s as a field element
Provided Methods§
sourcefn valid_or_zero(&self) -> Self
fn valid_or_zero(&self) -> Self
Returns 0 if this element is INVALID, else the value of this element. Unlike most methods, this may be called on an INVALID element.
sourcefn ensure_valid(&self) -> &Self
fn ensure_valid(&self) -> &Self
Returns this element, but checks to make sure it’s valid.
sourcefn as_u32_slice(elems: &[Self]) -> &[u32]
fn as_u32_slice(elems: &[Self]) -> &[u32]
Interprets a slice of these elements as u32s. These elements may not be INVALID.
sourcefn as_u32_slice_unchecked(elems: &[Self]) -> &[u32]
fn as_u32_slice_unchecked(elems: &[Self]) -> &[u32]
Interprets a slice of these elements as u32s. These elements may potentially be INVALID.
sourcefn from_u32_slice(u32s: &[u32]) -> &[Self] ⓘ
fn from_u32_slice(u32s: &[u32]) -> &[Self] ⓘ
Interprets a slice of u32s as a slice of these elements. These elements may not be INVALID.
sourcefn from_u32_slice_unchecked(u32s: &[u32]) -> &[Self] ⓘ
fn from_u32_slice_unchecked(u32s: &[u32]) -> &[Self] ⓘ
Interprets a slice of u32s as a slice of these elements. These elements may be INVALID.