Trait snarkvm_wasm::Field[][src]

pub trait Field: 'static + ToBytes + FromBytes + Copy + Clone + Debug + Display + Default + Send + Sync + Eq + One + Ord + Neg<Output = Self> + UniformRand + Zero + Hash + From<u128> + From<u64> + From<u32> + From<u16> + From<u8> + Add<Self, Output = Self, Output = Self> + Sub<Self, Output = Self, Output = Self> + Mul<Self, Output = Self, Output = Self> + Div<Self, Output = Self, Output = Self> + AddAssign<Self> + SubAssign<Self> + MulAssign<Self> + DivAssign<Self> + for<'a> Add<&'a Self> + for<'a> Sub<&'a Self> + for<'a> Mul<&'a Self> + for<'a> Div<&'a Self> + for<'a> AddAssign<&'a Self> + for<'a> SubAssign<&'a Self> + for<'a> MulAssign<&'a Self> + for<'a> DivAssign<&'a Self> + Sum<Self> + for<'a> Sum<&'a Self> + Product<Self> + for<'a> Product<&'a Self> + CanonicalSerialize + ConstantSerializedSize + CanonicalSerializeWithFlags + CanonicalDeserialize + CanonicalDeserializeWithFlags + Serialize + for<'a> Deserialize<'a> {
    fn characteristic<'a>() -> &'a [u64]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
;
fn double(&self) -> Self;
fn double_in_place(&mut self);
fn square(&self) -> Self;
fn square_in_place(&mut self) -> &mut Self;
fn inverse(&self) -> Option<Self>;
fn inverse_in_place(&mut self) -> Option<&mut Self>;
fn frobenius_map(&mut self, power: usize);
fn from_random_bytes_with_flags<F>(bytes: &[u8]) -> Option<(Self, F)>
    where
        F: Flags
; fn pow<S>(&self, exp: S) -> Self
    where
        S: AsRef<[u64]>
, { ... }
fn from_random_bytes(bytes: &[u8]) -> Option<Self> { ... } }
Expand description

The interface for a generic field.

Required methods

Returns the characteristic of the field.

Returns self + self.

Doubles self in place.

Returns self * self.

Squares self in place.

Computes the multiplicative inverse of self if self is nonzero.

Sets self to self’s inverse if it exists. Otherwise it is a no-op.

Exponentiates this element by a power of the base prime modulus via the Frobenius automorphism.

Returns a field element with an extra sign bit used for group parsing if the set of bytes forms a valid field element, otherwise returns None. This function is primarily intended for sampling random field elements from a hash-function or RNG output.

Provided methods

Exponentiates this element by a number represented with u64 limbs, least significant limb first.

Returns a field element if the set of bytes forms a valid field element, otherwise returns None. This function is primarily intended for sampling random field elements from a hash-function or RNG output.

Implementors