pub trait IsPrimeField: IsField {
type RepresentativeType: IsUnsignedInteger;
// Required methods
fn representative(a: &Self::BaseType) -> Self::RepresentativeType;
fn from_hex(hex_string: &str) -> Result<Self::BaseType, CreationError>;
fn to_hex(a: &Self::BaseType) -> String;
fn field_bit_size() -> usize;
// Provided methods
fn modulus_minus_one() -> Self::RepresentativeType { ... }
fn legendre_symbol(a: &Self::BaseType) -> LegendreSymbol { ... }
fn sqrt(a: &Self::BaseType) -> Option<(Self::BaseType, Self::BaseType)> { ... }
}
Required Associated Types§
Required Methods§
Sourcefn representative(a: &Self::BaseType) -> Self::RepresentativeType
fn representative(a: &Self::BaseType) -> Self::RepresentativeType
Returns the integer representative in the range [0, p-1], where p the modulus
Sourcefn from_hex(hex_string: &str) -> Result<Self::BaseType, CreationError>
fn from_hex(hex_string: &str) -> Result<Self::BaseType, CreationError>
Creates a BaseType from a Hex String
0x is optional
Returns an CreationError::InvalidHexString
if the value is not a hexstring
Sourcefn field_bit_size() -> usize
fn field_bit_size() -> usize
Returns the number of bits of the max element of the field, as per field documentation, not internal representation.
This is log2(max FE)
rounded up
Provided Methods§
fn modulus_minus_one() -> Self::RepresentativeType
fn legendre_symbol(a: &Self::BaseType) -> LegendreSymbol
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.