pub trait PrimeField:
Copy
+ Clone
+ Eq
+ PartialEq
+ Ord
+ PartialOrd
+ Debug {
const MODULUS: u128;
const BITS: u32;
const ZERO: Self;
const ONE: Self;
// Required methods
fn from_u64(v: u64) -> Self;
fn to_u64(self) -> u64;
fn add(self, rhs: Self) -> Self;
fn sub(self, rhs: Self) -> Self;
fn mul(self, rhs: Self) -> Self;
fn neg(self) -> Self;
// Provided methods
fn inv(self) -> Option<Self> { ... }
fn pow(self, exp: u64) -> Self { ... }
fn pow_u128(self, exp: u128) -> Self { ... }
}Expand description
Trait for prime field arithmetic.
Warriors use this for field-generic hash functions, proof estimation, and verification. Trident provides concrete implementations; warriors call them without reimplementing the math.
Required Associated Constants§
Required Methods§
Provided Methods§
Sourcefn inv(self) -> Option<Self>
fn inv(self) -> Option<Self>
Multiplicative inverse via Fermat: a^(p-2) mod p. Returns None for zero.
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.