pub trait Deserializable: Sized {
    // Required method
    fn read_from<R>(source: &mut R) -> Result<Self, DeserializationError>
       where R: ByteReader;

    // Provided method
    fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError> { ... }
}
Expand description

Defines how to deserialize Self from bytes.

Required Methods§

fn read_from<R>(source: &mut R) -> Result<Self, DeserializationError>
where R: ByteReader,

Reads a sequence of bytes from the provided source, attempts to deserialize these bytes into Self, and returns the result.

§Errors

Returns an error if:

  • The source does not contain enough bytes to deserialize Self.
  • Bytes read from the source do not represent a valid value for Self.

Provided Methods§

fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>

Attempts to deserialize the provided bytes into Self and returns the result.

§Errors

Returns an error if:

  • The bytes do not contain enough information to deserialize Self.
  • The bytes do not represent a valid value for Self.

Note: if bytes contains more data than needed to deserialize self, no error is returned.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Deserializable for HashFunction

§

impl Deserializable for u8

§

impl Deserializable for u16

§

impl Deserializable for u32

§

impl Deserializable for u64

§

impl Deserializable for u128

§

impl Deserializable for ()

§

impl Deserializable for usize

source§

impl Deserializable for ExecutionProof

source§

impl Deserializable for PublicInputs

§

impl Deserializable for BaseElement

§

fn read_from<R>(source: &mut R) -> Result<BaseElement, DeserializationError>
where R: ByteReader,

§

impl Deserializable for BaseElement

§

fn read_from<R>(source: &mut R) -> Result<BaseElement, DeserializationError>
where R: ByteReader,

§

impl Deserializable for Commitments

§

fn read_from<R>(source: &mut R) -> Result<Commitments, DeserializationError>
where R: ByteReader,

Reads commitments from the specified source and returns the result.

§Errors

Returns an error of a valid Commitments struct could not be read from the specified source.

§

impl Deserializable for Context

§

fn read_from<R>(source: &mut R) -> Result<Context, DeserializationError>
where R: ByteReader,

Reads proof context from the specified source and returns the result.

§Errors

Returns an error of a valid Context struct could not be read from the specified source.

§

impl Deserializable for FieldExtension

§

fn read_from<R>(source: &mut R) -> Result<FieldExtension, DeserializationError>
where R: ByteReader,

Reads a field extension enum from the specified source.

§

impl Deserializable for FriProof

§

fn read_from<R>(source: &mut R) -> Result<FriProof, DeserializationError>
where R: ByteReader,

Reads a FRI proof from the specified source and returns the result.

§Errors

Returns an error if a valid proof could not be read from the source.

§

impl Deserializable for KeyPair

§

fn read_from<R>(source: &mut R) -> Result<KeyPair, DeserializationError>
where R: ByteReader,

§

impl Deserializable for OodFrame

§

fn read_from<R>(source: &mut R) -> Result<OodFrame, DeserializationError>
where R: ByteReader,

Reads a OOD frame from the specified source and returns the result

§Errors

Returns an error of a valid OOD frame could not be read from the specified source.

§

impl Deserializable for ProofOptions

§

fn read_from<R>(source: &mut R) -> Result<ProofOptions, DeserializationError>
where R: ByteReader,

Reads proof options from the specified source and returns the result.

§Errors

Returns an error of a valid proof options could not be read from the specified source.

§

impl Deserializable for Queries

§

fn read_from<R>(source: &mut R) -> Result<Queries, DeserializationError>
where R: ByteReader,

Reads a query struct from the specified source and returns the result

§Errors

Returns an error of a valid query struct could not be read from the specified source.

§

impl Deserializable for RootPath

§

fn read_from<R>(source: &mut R) -> Result<RootPath, DeserializationError>
where R: ByteReader,

§

impl Deserializable for RpxDigest

§

fn read_from<R>(source: &mut R) -> Result<RpxDigest, DeserializationError>
where R: ByteReader,

§

impl Deserializable for Signature

§

fn read_from<R>(source: &mut R) -> Result<Signature, DeserializationError>
where R: ByteReader,

§

impl Deserializable for SmtLeaf

§

fn read_from<R>(source: &mut R) -> Result<SmtLeaf, DeserializationError>
where R: ByteReader,

§

impl Deserializable for SmtProof

§

fn read_from<R>(source: &mut R) -> Result<SmtProof, DeserializationError>
where R: ByteReader,

§

impl Deserializable for StarkProof

§

fn read_from<R>(source: &mut R) -> Result<StarkProof, DeserializationError>
where R: ByteReader,

§

impl Deserializable for StoreNode

§

fn read_from<R>(source: &mut R) -> Result<StoreNode, DeserializationError>
where R: ByteReader,

§

impl Deserializable for TraceLayout

§

fn read_from<R>(source: &mut R) -> Result<TraceLayout, DeserializationError>
where R: ByteReader,

Reads [TraceLayout] from the specified source and returns the result.

§Errors

Returns an error of a valid [TraceLayout] struct could not be read from the specified source.

§

impl Deserializable for ValuePath

§

fn read_from<R>(source: &mut R) -> Result<ValuePath, DeserializationError>
where R: ByteReader,

§

impl<B> Deserializable for CubeExtension<B>
where B: ExtensibleField<3>,

§

fn read_from<R>( source: &mut R ) -> Result<CubeExtension<B>, DeserializationError>
where R: ByteReader,

§

impl<T1> Deserializable for (T1,)
where T1: Deserializable,

§

impl<T1, T2> Deserializable for (T1, T2)

§

impl<T1, T2, T3> Deserializable for (T1, T2, T3)

§

impl<T1, T2, T3, T4> Deserializable for (T1, T2, T3, T4)

§

impl<T1, T2, T3, T4, T5> Deserializable for (T1, T2, T3, T4, T5)

§

impl<T1, T2, T3, T4, T5, T6> Deserializable for (T1, T2, T3, T4, T5, T6)

§

impl<T> Deserializable for Option<T>
where T: Deserializable,

§

impl<T, const C: usize> Deserializable for [T; C]
where T: Deserializable,

§

impl<const N: usize> Deserializable for Blake3Digest<N>

§

fn read_from<R>(source: &mut R) -> Result<Blake3Digest<N>, DeserializationError>
where R: ByteReader,

Implementors§