Skip to main content

FromBytes

Trait FromBytes 

Source
pub trait FromBytes {
    // Required method
    fn read_le<R>(reader: R) -> Result<Self, Error>
       where R: Read,
             Self: Sized;

    // Provided methods
    fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>
       where Self: Sized { ... }
    fn from_bytes_le_unchecked(bytes: &[u8]) -> Result<Self, Error>
       where Self: Sized { ... }
    fn read_le_unchecked<R>(reader: R) -> Result<Self, Error>
       where R: Read,
             Self: Sized { ... }
    fn read_le_with_unchecked<R>(
        reader: R,
        unchecked: bool,
    ) -> Result<Self, Error>
       where R: Read,
             Self: Sized { ... }
}

Required Methods§

Source

fn read_le<R>(reader: R) -> Result<Self, Error>
where R: Read, Self: Sized,

Reads Self from reader as little-endian bytes.

Provided Methods§

Source

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

Returns Self from a byte array in little-endian order.

Source

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

Same behavior as Self::from_bytes_le but avoids costly checks. This shall only be called when deserializing from a trusted source, such as local storage.

Returns Self from a byte array in little-endian order.

Source

fn read_le_unchecked<R>(reader: R) -> Result<Self, Error>
where R: Read, Self: Sized,

Same behavior as Self::read_le but avoids costly checks. This shall only be called when deserializing from a trusted source, such as local storage.

The default implementation simply calls Self::read_le.

Source

fn read_le_with_unchecked<R>(reader: R, unchecked: bool) -> Result<Self, Error>
where R: Read, Self: Sized,

Helper function that deserializes either unchecked or checked based on the given boolean flag.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FromBytes for SocketAddr

Source§

fn read_le<R>(reader: R) -> Result<SocketAddr, Error>
where R: Read,

Source§

impl FromBytes for VarunaVersion

Source§

fn read_le<R>(reader: R) -> Result<VarunaVersion, Error>
where R: Read,

Source§

impl FromBytes for bool

Source§

fn read_le<R>(reader: R) -> Result<bool, Error>
where R: Read,

Source§

impl FromBytes for i8

Source§

fn read_le<R>(reader: R) -> Result<i8, Error>
where R: Read,

Source§

impl FromBytes for i16

Source§

fn read_le<R>(reader: R) -> Result<i16, Error>
where R: Read,

Source§

impl FromBytes for i32

Source§

fn read_le<R>(reader: R) -> Result<i32, Error>
where R: Read,

Source§

impl FromBytes for i64

Source§

fn read_le<R>(reader: R) -> Result<i64, Error>
where R: Read,

Source§

impl FromBytes for i128

Source§

fn read_le<R>(reader: R) -> Result<i128, Error>
where R: Read,

Source§

impl FromBytes for u8

Source§

fn read_le<R>(reader: R) -> Result<u8, Error>
where R: Read,

Source§

impl FromBytes for u16

Source§

fn read_le<R>(reader: R) -> Result<u16, Error>
where R: Read,

Source§

impl FromBytes for u32

Source§

fn read_le<R>(reader: R) -> Result<u32, Error>
where R: Read,

Source§

impl FromBytes for u64

Source§

fn read_le<R>(reader: R) -> Result<u64, Error>
where R: Read,

Source§

impl FromBytes for u128

Source§

fn read_le<R>(reader: R) -> Result<u128, Error>
where R: Read,

Source§

impl FromBytes for ()

Source§

fn read_le<R>(_bytes: R) -> Result<(), Error>
where R: Read,

Source§

impl FromBytes for ECDSASignature

Source§

fn read_le<R>(reader: R) -> Result<ECDSASignature, Error>
where R: Read,

Source§

impl FromBytes for RecoveryID

Source§

fn read_le<R>(reader: R) -> Result<RecoveryID, Error>
where R: Read,

Source§

impl<E> FromBytes for KZGCommitment<E>
where E: PairingEngine,

Source§

fn read_le<R>(reader: R) -> Result<KZGCommitment<E>, Error>
where R: Read,

Source§

impl<E> FromBytes for KZGProof<E>
where E: PairingEngine,

Source§

fn read_le<R>(reader: R) -> Result<KZGProof<E>, Error>
where R: Read,

Source§

impl<E> FromBytes for KZGRandomness<E>
where E: PairingEngine,

Source§

fn read_le<R>(reader: R) -> Result<KZGRandomness<E>, Error>
where R: Read,

Source§

impl<E> FromBytes for UniversalParams<E>
where E: PairingEngine,

Source§

fn read_le<R>(reader: R) -> Result<UniversalParams<E>, Error>
where R: Read,

Source§

impl<E> FromBytes for VerifierKey<E>
where E: PairingEngine,

Source§

fn read_le<R>(reader: R) -> Result<VerifierKey<E>, Error>
where R: Read,

Source§

impl<E> FromBytes for BatchLCProof<E>
where E: PairingEngine,

Source§

fn read_le<R>(reader: R) -> Result<BatchLCProof<E>, Error>
where R: Read,

Source§

fn read_le_unchecked<R>(reader: R) -> Result<BatchLCProof<E>, Error>
where R: Read,

Source§

impl<E> FromBytes for CommitterKey<E>
where E: PairingEngine,

Source§

fn read_le<R>(reader: R) -> Result<CommitterKey<E>, Error>
where R: Read,

Source§

impl<E> FromBytes for Certificate<E>
where E: PairingEngine,

Source§

fn read_le<R>(r: R) -> Result<Certificate<E>, Error>
where R: Read,

Source§

fn read_le_unchecked<R>(r: R) -> Result<Certificate<E>, Error>
where R: Read,

Source§

impl<E> FromBytes for CircuitVerifyingKey<E>
where E: PairingEngine,

Source§

impl<E> FromBytes for Proof<E>
where E: PairingEngine,

Source§

fn read_le<R>(r: R) -> Result<Proof<E>, Error>
where R: Read,

Source§

fn read_le_unchecked<R>(r: R) -> Result<Proof<E>, Error>
where R: Read,

Source§

impl<E> FromBytes for Boolean<E>
where E: Environment,

Source§

fn read_le<R>(reader: R) -> Result<Boolean<E>, Error>
where R: Read,

Reads the boolean from a buffer.

Source§

impl<E> FromBytes for Field<E>
where E: Environment,

Source§

fn read_le<R>(reader: R) -> Result<Field<E>, Error>
where R: Read,

Reads the field from a buffer.

Source§

impl<E> FromBytes for Group<E>
where E: Environment,

Source§

fn read_le<R>(reader: R) -> Result<Group<E>, Error>
where R: Read,

Reads the group from a buffer.

Source§

impl<E> FromBytes for Scalar<E>
where E: Environment,

Source§

fn read_le<R>(reader: R) -> Result<Scalar<E>, Error>
where R: Read,

Reads the scalar from a buffer.

Source§

impl<E> FromBytes for PowersOfBetaG<E>
where E: PairingEngine,

Source§

fn read_le<R>(reader: R) -> Result<PowersOfBetaG<E>, Error>
where R: Read,

Reads the powers from the buffer.

Source§

impl<E> FromBytes for PowersOfG<E>
where E: PairingEngine,

Source§

fn read_le<R>(reader: R) -> Result<PowersOfG<E>, Error>
where R: Read,

Reads the powers from the buffer.

Source§

impl<E, I> FromBytes for Integer<E, I>
where E: Environment, I: IntegerType,

Source§

fn read_le<R>(reader: R) -> Result<Integer<E, I>, Error>
where R: Read,

Reads the integer from a buffer.

Source§

impl<E, SM> FromBytes for CircuitProvingKey<E, SM>
where E: PairingEngine, SM: SNARKMode,

Source§

fn read_le<R>(reader: R) -> Result<CircuitProvingKey<E, SM>, Error>
where R: Read,

Source§

impl<E, const DEPTH: u8> FromBytes for MerklePath<E, DEPTH>
where E: Environment,

Source§

fn read_le<R>(reader: R) -> Result<MerklePath<E, DEPTH>, Error>
where R: Read,

Reads in a Merkle path from a buffer.

Source§

impl<L, R> FromBytes for (L, R)
where L: FromBytes, R: FromBytes,

Source§

fn read_le<Reader>(reader: Reader) -> Result<(L, R), Error>
where Reader: Read,

Source§

impl<P> FromBytes for G1Prepared<P>
where P: Bls12Parameters,

Source§

fn read_le<R>(reader: R) -> Result<G1Prepared<P>, Error>
where R: Read,

Source§

impl<P> FromBytes for G2Prepared<P>
where P: Bls12Parameters,

Source§

fn read_le<R>(reader: R) -> Result<G2Prepared<P>, Error>
where R: Read,

Source§

impl<P> FromBytes for Affine<P>

Source§

fn read_le<R>(reader: R) -> Result<Affine<P>, Error>
where R: Read,

Source§

impl<P> FromBytes for Projective<P>

Source§

fn read_le<R>(reader: R) -> Result<Projective<P>, Error>
where R: Read,

Source§

impl<P> FromBytes for Affine<P>

Source§

fn read_le<R>(reader: R) -> Result<Affine<P>, Error>
where R: Read,

Source§

impl<P> FromBytes for Projective<P>

Source§

fn read_le<R>(reader: R) -> Result<Projective<P>, Error>
where R: Read,

Source§

impl<P> FromBytes for Fp2<P>
where P: Fp2Parameters,

Source§

fn read_le<R>(reader: R) -> Result<Fp2<P>, Error>
where R: Read,

Source§

impl<P> FromBytes for Fp6<P>
where P: Fp6Parameters,

Source§

fn read_le<R>(reader: R) -> Result<Fp6<P>, Error>
where R: Read,

Source§

impl<P> FromBytes for Fp12<P>
where P: Fp12Parameters,

Source§

fn read_le<R>(reader: R) -> Result<Fp12<P>, Error>
where R: Read,

Source§

impl<P> FromBytes for Fp256<P>
where P: Fp256Parameters,

Source§

fn read_le<R>(reader: R) -> Result<Fp256<P>, Error>
where R: Read,

Source§

impl<P> FromBytes for Fp384<P>
where P: Fp384Parameters,

Source§

fn read_le<R>(reader: R) -> Result<Fp384<P>, Error>
where R: Read,

Source§

impl<PH, const DEPTH: u8, const ARITY: u8> FromBytes for KaryMerklePath<PH, DEPTH, ARITY>
where PH: PathHash,

Source§

fn read_le<R>(reader: R) -> Result<KaryMerklePath<PH, DEPTH, ARITY>, Error>
where R: Read,

Reads in a Merkle path from a buffer.

Source§

impl<const N: usize> FromBytes for [u8; N]

Source§

fn read_le<R>(reader: R) -> Result<[u8; N], Error>
where R: Read,

Source§

impl<const N: usize> FromBytes for [u16; N]

Source§

fn read_le<R>(reader: R) -> Result<[u16; N], Error>
where R: Read,

Source§

impl<const N: usize> FromBytes for [u32; N]

Source§

fn read_le<R>(reader: R) -> Result<[u32; N], Error>
where R: Read,

Source§

impl<const N: usize> FromBytes for [u64; N]

Source§

fn read_le<R>(reader: R) -> Result<[u64; N], Error>
where R: Read,

Source§

impl<const VARIANT: usize> FromBytes for BooleanHash<VARIANT>

Source§

fn read_le<R>(reader: R) -> Result<BooleanHash<VARIANT>, Error>
where R: Read,

Reads self from reader in little-endian order.

Implementors§