pub trait ByteConversion {
    // Required methods
    fn to_bytes_be(&self) -> Vec<u8>;
    fn to_bytes_le(&self) -> Vec<u8>;
    fn from_bytes_be(bytes: &[u8]) -> Result<Self, ByteConversionError>
       where Self: Sized;
    fn from_bytes_le(bytes: &[u8]) -> Result<Self, ByteConversionError>
       where Self: Sized;
}
Expand description

A trait for converting an element to and from its byte representation and for getting an element from its byte representation in big-endian or little-endian order.

Required Methods§

source

fn to_bytes_be(&self) -> Vec<u8>

Returns the byte representation of the element in big-endian order.}

source

fn to_bytes_le(&self) -> Vec<u8>

Returns the byte representation of the element in little-endian order.

source

fn from_bytes_be(bytes: &[u8]) -> Result<Self, ByteConversionError>where Self: Sized,

Returns the element from its byte representation in big-endian order.

source

fn from_bytes_le(bytes: &[u8]) -> Result<Self, ByteConversionError>where Self: Sized,

Returns the element from its byte representation in little-endian order.

Implementors§

source§

impl ByteConversion for FieldElement<Degree2ExtensionField>

source§

impl<M, const NUM_LIMBS: usize> ByteConversion for FieldElement<MontgomeryBackendPrimeField<M, NUM_LIMBS>>where M: IsModulus<UnsignedInteger<NUM_LIMBS>> + Clone + Debug,

source§

impl<const MODULUS: u64> ByteConversion for U64FieldElement<MODULUS>

source§

impl<const NUM_LIMBS: usize> ByteConversion for UnsignedInteger<NUM_LIMBS>