Macro elliptic_curve::impl_field_element
source · macro_rules! impl_field_element { ( $fe:tt, $bytes:ty, $uint:ty, $modulus:expr, $arr:ty, $from_mont:ident, $to_mont:ident, $add:ident, $sub:ident, $mul:ident, $neg:ident, $square:ident ) => { ... }; }
Expand description
Provides both inherent and trait impls for a field element type which are backed by a core set of arithmetic functions specified as macro arguments.
Inherent impls
const ZERO: Self
const ONE: Self
(multiplicative identity)pub fn from_be_bytes
pub fn from_be_slice
pub fn from_le_bytes
pub fn from_le_slice
pub fn from_uint
fn from_uint_unchecked
pub fn to_be_bytes
pub fn to_le_bytes
pub fn to_canonical
pub fn is_odd
pub fn is_zero
pub fn double
NOTE: field implementations must provide their own inherent impls of the following methods in order for the code generated by this macro to compile:
pub fn invert
pub fn sqrt
Trait impls
AsRef<$arr>
ConditionallySelectable
ConstantTimeEq
ConstantTimeGreater
ConstantTimeLess
Default
DefaultIsZeroes
Eq
Field
PartialEq
Ops
Add
AddAssign
Sub
SubAssign
Mul
MulAssign
Neg