halo2curves::serde

Trait SerdeObject

Source
pub trait SerdeObject: Sized {
    // Required methods
    fn from_raw_bytes_unchecked(bytes: &[u8]) -> Self;
    fn from_raw_bytes(bytes: &[u8]) -> Option<Self>;
    fn to_raw_bytes(&self) -> Vec<u8>;
    fn read_raw_unchecked<R: Read>(reader: &mut R) -> Self;
    fn read_raw<R: Read>(reader: &mut R) -> Result<Self>;
    fn write_raw<W: Write>(&self, writer: &mut W) -> Result<()>;
}
Expand description

Trait for converting raw bytes to/from the internal representation of a type. For example, field elements are represented in Montgomery form and serialized/deserialized without Montgomery reduction.

Required Methods§

Source

fn from_raw_bytes_unchecked(bytes: &[u8]) -> Self

The purpose of unchecked functions is to read the internal memory representation of a type from bytes as quickly as possible. No sanitization checks are performed to ensure the bytes represent a valid object. As such this function should only be used internally as an extension of machine memory. It should not be used to deserialize externally provided data.

Source

fn from_raw_bytes(bytes: &[u8]) -> Option<Self>

Source

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

Source

fn read_raw_unchecked<R: Read>(reader: &mut R) -> Self

The purpose of unchecked functions is to read the internal memory representation of a type from disk as quickly as possible. No sanitization checks are performed to ensure the bytes represent a valid object. This function should only be used internally when some machine state cannot be kept in memory (e.g., between runs) and needs to be reloaded as quickly as possible.

Source

fn read_raw<R: Read>(reader: &mut R) -> Result<Self>

Source

fn write_raw<W: Write>(&self, writer: &mut W) -> Result<()>

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.

Implementors§

Source§

impl SerdeObject for halo2curves::bls12381::Fq

Source§

impl SerdeObject for halo2curves::bls12381::Fr

Source§

impl SerdeObject for halo2curves::bls12381::G1

Source§

impl SerdeObject for halo2curves::bls12381::G1Affine

Source§

impl SerdeObject for halo2curves::bls12381::G2

Source§

impl SerdeObject for halo2curves::bls12381::G2Affine

Source§

impl SerdeObject for halo2curves::bn256::Fq

Source§

impl SerdeObject for halo2curves::bn256::Fr

Source§

impl SerdeObject for halo2curves::bn256::G1

Source§

impl SerdeObject for halo2curves::bn256::G1Affine

Source§

impl SerdeObject for halo2curves::bn256::G2

Source§

impl SerdeObject for halo2curves::bn256::G2Affine

Source§

impl SerdeObject for QuadExtField<Fp>

Source§

impl SerdeObject for halo2curves::grumpkin::G1

Source§

impl SerdeObject for halo2curves::grumpkin::G1Affine

Source§

impl SerdeObject for Eris

Source§

impl SerdeObject for ErisAffine

Source§

impl SerdeObject for halo2curves::pluto_eris::Fp

Source§

impl SerdeObject for halo2curves::pluto_eris::Fq

Source§

impl SerdeObject for halo2curves::pluto_eris::G1

Source§

impl SerdeObject for halo2curves::pluto_eris::G1Affine

Source§

impl SerdeObject for halo2curves::pluto_eris::G2

Source§

impl SerdeObject for halo2curves::pluto_eris::G2Affine

Source§

impl SerdeObject for halo2curves::secp256k1::Fp

Source§

impl SerdeObject for halo2curves::secp256k1::Fq

Source§

impl SerdeObject for Secp256k1

Source§

impl SerdeObject for Secp256k1Affine

Source§

impl SerdeObject for halo2curves::secp256r1::Fp

Source§

impl SerdeObject for halo2curves::secp256r1::Fq

Source§

impl SerdeObject for Secp256r1

Source§

impl SerdeObject for Secp256r1Affine

Source§

impl SerdeObject for Secq256k1

Source§

impl SerdeObject for Secq256k1Affine

Source§

impl SerdeObject for halo2curves::bls12381::Fq2

Source§

impl SerdeObject for halo2curves::bn256::Fq2