Trait halo2_backend::helpers::SerdePrimeField
source · pub trait SerdePrimeField: PrimeField + SerdeObject {
// Provided methods
fn read<R: Read>(reader: &mut R, format: SerdeFormat) -> Result<Self> { ... }
fn write<W: Write>(&self, writer: &mut W, format: SerdeFormat) -> Result<()> { ... }
}
Provided Methods§
sourcefn read<R: Read>(reader: &mut R, format: SerdeFormat) -> Result<Self>
fn read<R: Read>(reader: &mut R, format: SerdeFormat) -> Result<Self>
Reads a field element as bytes from the buffer according to the format
:
Processed
: Reads a field element in standard form, with endianness specified by thePrimeField
implementation, and checks that the element is less than the modulus.RawBytes
: Reads a field element from raw bytes in its internal Montgomery representations, and checks that the element is less than the modulus.RawBytesUnchecked
: Reads a field element in Montgomery form and performs no checks.
sourcefn write<W: Write>(&self, writer: &mut W, format: SerdeFormat) -> Result<()>
fn write<W: Write>(&self, writer: &mut W, format: SerdeFormat) -> Result<()>
Writes a field element as bytes to the buffer according to the format
:
Processed
: Writes a field element in standard form, with endianness specified by thePrimeField
implementation.- Otherwise: Writes a field element into raw bytes in its internal Montgomery representation, WITHOUT performing the expensive Montgomery reduction.
Object Safety§
This trait is not object safe.