pub trait Field:
'static
+ Copy
+ Clone
+ Debug
+ Display
+ Default
+ Send
+ Sync
+ Eq
+ Zero
+ One
+ Ord
+ Neg<Output = Self>
+ Zeroize
+ Sized
+ Hash
+ AdditiveGroup<Scalar = Self>
+ Div<Self, Output = Self>
+ DivAssign<Self>
+ for<'a> Div<&'a Self, Output = Self>
+ for<'a> DivAssign<&'a Self>
+ for<'a> Div<&'a mut Self, Output = Self>
+ for<'a> DivAssign<&'a mut Self>
+ for<'a> Product<&'a Self>
+ From<u128>
+ From<u64>
+ From<u32>
+ From<u16>
+ From<u8>
+ From<i128>
+ From<i64>
+ From<i32>
+ From<i16>
+ From<i8>
+ From<bool>
+ Product<Self> {
const ONE: Self;
// Required methods
fn extension_degree() -> usize;
fn square(&self) -> Self;
fn square_in_place(&mut self) -> &mut Self;
fn inverse(&self) -> Option<Self>;
fn inverse_in_place(&mut self) -> Option<&mut Self>;
// Provided methods
fn pow<S: BitIteratorBE>(&self, exp: S) -> Self { ... }
fn sum_of_products<const T: usize>(a: &[Self; T], b: &[Self; T]) -> Self { ... }
}Expand description
Defines an abstract field.
Types implementing Field support common field operations such as
addition, subtraction, multiplication, and inverses.
Required Associated Constants§
Required Methods§
Sourcefn extension_degree() -> usize
fn extension_degree() -> usize
Returns the extension degree of this field.
Sourcefn square_in_place(&mut self) -> &mut Self
fn square_in_place(&mut self) -> &mut Self
Squares self in place.
Sourcefn inverse(&self) -> Option<Self>
fn inverse(&self) -> Option<Self>
Computes the multiplicative inverse of self if self is nonzero.
Sourcefn inverse_in_place(&mut self) -> Option<&mut Self>
fn inverse_in_place(&mut self) -> Option<&mut Self>
If self.inverse().is_none(), this just returns None. Otherwise, it
sets self to self.inverse().unwrap().
Provided Methods§
Sourcefn pow<S: BitIteratorBE>(&self, exp: S) -> Self
fn pow<S: BitIteratorBE>(&self, exp: S) -> Self
Returns self^exp, where exp is an integer.
NOTE: Consumers should pass exp’s type S with the least bit size
possible.
e.g. for pow(12) u8 type is small enough to represent 12.
Sourcefn sum_of_products<const T: usize>(a: &[Self; T], b: &[Self; T]) -> Self
fn sum_of_products<const T: usize>(a: &[Self; T], b: &[Self; T]) -> Self
Returns sum([a_i * b_i]).
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.