pub trait Field:
Sized
+ Eq
+ Copy
+ Clone
+ Send
+ Sync
+ Debug {
// Required methods
fn random<R>(rng: &mut R) -> Self
where R: RngCore + ?Sized;
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>;
// Provided method
fn pow<S>(&self, exp: S) -> Self
where S: AsRef<[u64]> { ... }
}Expand description
This trait represents an element of a field.
The trait essentially copies ff::Field from v0.5.
Required Methods§
Sourcefn random<R>(rng: &mut R) -> Self
fn random<R>(rng: &mut R) -> Self
Returns an element chosen uniformly at random using a user-provided RNG.
Sourcefn add_assign(&mut self, other: &Self)
fn add_assign(&mut self, other: &Self)
Adds another element to this element.
Sourcefn sub_assign(&mut self, other: &Self)
fn sub_assign(&mut self, other: &Self)
Subtracts another element from this element.
Sourcefn mul_assign(&mut self, other: &Self)
fn mul_assign(&mut self, other: &Self)
Multiplies another element by this element.
Provided Methods§
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.