pub trait Field: Sized {
type Elem: Default + Clone + Copy + PartialEq + Debug;
const ORDER: usize;
// Required methods
fn add(a: Self::Elem, b: Self::Elem) -> Self::Elem;
fn mul(a: Self::Elem, b: Self::Elem) -> Self::Elem;
fn div(a: Self::Elem, b: Self::Elem) -> Self::Elem;
fn exp(a: Self::Elem, n: usize) -> Self::Elem;
fn zero() -> Self::Elem;
fn one() -> Self::Elem;
fn nth_internal(n: usize) -> Self::Elem;
// Provided methods
fn nth_checked(n: usize) -> Option<Self::Elem> { ... }
fn nth(n: usize) -> Self::Elem { ... }
fn mul_slice(elem: Self::Elem, input: &[Self::Elem], out: &mut [Self::Elem]) { ... }
fn mul_slice_add(
elem: Self::Elem,
input: &[Self::Elem],
out: &mut [Self::Elem],
) { ... }
}Expand description
A finite field to perform encoding over.
Required Associated Constants§
Required Associated Types§
Required Methods§
fn nth_internal(n: usize) -> Self::Elem
Provided Methods§
Sourcefn nth_checked(n: usize) -> Option<Self::Elem>
fn nth_checked(n: usize) -> Option<Self::Elem>
Return Some when n < ORDER, otherwise None.
Sourcefn nth(n: usize) -> Self::Elem
fn nth(n: usize) -> Self::Elem
Yield the nth element of the field.
For out-of-range n, returns a wrapping value in production and triggers a
debug assertion.
Assignment is arbitrary but must be unique to n.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".