Trait Field

Source
pub trait Field:
    Sized
    + Eq
    + Copy
    + Clone
    + Send
    + Sync
    + Debug
    + Display
    + 'static {
Show 13 methods // Required methods fn random<R: RngCore + ?Sized>(rng: &mut R) -> Self; fn zero() -> Self; fn one() -> Self; fn is_zero(&self) -> bool; fn square(&mut self); fn double(&mut self); fn negate(&mut self); fn add_assign(&mut self, other: &Self); fn sub_assign(&mut self, other: &Self); fn mul_assign(&mut self, other: &Self); fn inverse(&self) -> Option<Self>; fn frobenius_map(&mut self, power: usize); // Provided method fn pow<S: AsRef<[u64]>>(&self, exp: S) -> Self { ... }
}
Expand description

This trait represents an element of a field.

Required Methods§

Source

fn random<R: RngCore + ?Sized>(rng: &mut R) -> Self

Returns an element chosen uniformly at random using a user-provided RNG.

Source

fn zero() -> Self

Returns the zero element of the field, the additive identity.

Source

fn one() -> Self

Returns the one element of the field, the multiplicative identity.

Source

fn is_zero(&self) -> bool

Returns true iff this element is zero.

Source

fn square(&mut self)

Squares this element.

Source

fn double(&mut self)

Doubles this element.

Source

fn negate(&mut self)

Negates this element.

Source

fn add_assign(&mut self, other: &Self)

Adds another element to this element.

Source

fn sub_assign(&mut self, other: &Self)

Subtracts another element from this element.

Source

fn mul_assign(&mut self, other: &Self)

Multiplies another element by this element.

Source

fn inverse(&self) -> Option<Self>

Computes the multiplicative inverse of this element, if nonzero.

Source

fn frobenius_map(&mut self, power: usize)

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

Provided Methods§

Source

fn pow<S: AsRef<[u64]>>(&self, exp: S) -> Self

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§