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§

source

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 the PrimeField 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.
source

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 the PrimeField 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.

Implementors§

source§

impl<F: PrimeField + SerdeObject> SerdePrimeField for F