pub trait ScalarField:
PrimeField
+ FromUniformBytes<64>
+ From<bool>
+ Hash
+ Ord {
// Required methods
fn to_u64_limbs(self, num_limbs: usize, bit_len: usize) -> Vec<u64>;
fn to_bytes_le(&self) -> Vec<u8> ⓘ;
// Provided methods
fn from_bytes_le(bytes: &[u8]) -> Self { ... }
fn get_lower_32(&self) -> u32 { ... }
fn get_lower_64(&self) -> u64 { ... }
}
Expand description
Required Methods§
Sourcefn to_u64_limbs(self, num_limbs: usize, bit_len: usize) -> Vec<u64>
fn to_u64_limbs(self, num_limbs: usize, bit_len: usize) -> Vec<u64>
Returns the base 2<sup>bit_len</sup>
little endian representation of the ScalarField element up to num_limbs
number of limbs (truncates any extra limbs).
Assumes bit_len < 64
.
num_limbs
: number of limbs to returnbit_len
: number of bits in each limb
Sourcefn to_bytes_le(&self) -> Vec<u8> ⓘ
fn to_bytes_le(&self) -> Vec<u8> ⓘ
Returns the little endian byte representation of the element.
Provided Methods§
Sourcefn from_bytes_le(bytes: &[u8]) -> Self
fn from_bytes_le(bytes: &[u8]) -> Self
Creates a field element from a little endian byte representation.
The default implementation assumes that PrimeField::from_repr
is implemented for little-endian.
It should be overriden if this is not the case.
Sourcefn get_lower_32(&self) -> u32
fn get_lower_32(&self) -> u32
Gets the least significant 32 bits of the field element.
Sourcefn get_lower_64(&self) -> u64
fn get_lower_64(&self) -> u64
Gets the least significant 64 bits of the field element.
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.