pub trait FieldFn<F: Field> {
// Required method
fn call<E: FieldOps<Scalar = F> + From<F>>(&self, inputs: &[E]) -> E;
// Provided method
fn call_native(&self, inputs: &[F]) -> F { ... }
}Expand description
An arithmetic function over field elements, generic in the field it evaluates in.
A closure FnOnce(&[F]) -> F is monomorphic: it runs in one fixed field.
Carrying the genericity on the method instead lets one value run in many fields:
- natively, in the verifier’s own base field
F; - over any larger field
Ewhose scalar isF.
Required Methods§
Provided Methods§
Sourcefn call_native(&self, inputs: &[F]) -> F
fn call_native(&self, inputs: &[F]) -> F
Evaluates the function on inputs natively in the base field F.
The default is self.call::<F>(inputs); implementors may override with a base-field
specialized fast path (e.g. deferred WideMul reduction) that the generic
call — which cannot assume E: WideMul — can’t express. Callers evaluating
in F should prefer this.
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.