Trait winter_prover::Deserializable
source · 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§
sourcefn read_from<R>(source: &mut R) -> Result<Self, DeserializationError>where
R: ByteReader,
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
sourcedoes not contain enough bytes to deserializeSelf. - Bytes read from the
sourcedo not represent a valid value forSelf.
Provided Methods§
sourcefn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
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
bytesdo not contain enough information to deserializeSelf. - The
bytesdo not represent a valid value forSelf.
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 u8
impl Deserializable for u8
fn read_from<R>(source: &mut R) -> Result<u8, DeserializationError>where
R: ByteReader,
source§impl Deserializable for u16
impl Deserializable for u16
fn read_from<R>(source: &mut R) -> Result<u16, DeserializationError>where
R: ByteReader,
source§impl Deserializable for u32
impl Deserializable for u32
fn read_from<R>(source: &mut R) -> Result<u32, DeserializationError>where
R: ByteReader,
source§impl Deserializable for u64
impl Deserializable for u64
fn read_from<R>(source: &mut R) -> Result<u64, DeserializationError>where
R: ByteReader,
source§impl Deserializable for u128
impl Deserializable for u128
fn read_from<R>(source: &mut R) -> Result<u128, DeserializationError>where
R: ByteReader,
source§impl Deserializable for ()
impl Deserializable for ()
fn read_from<R>(_source: &mut R) -> Result<(), DeserializationError>where
R: ByteReader,
source§impl Deserializable for usize
impl Deserializable for usize
fn read_from<R>(source: &mut R) -> Result<usize, DeserializationError>where
R: ByteReader,
source§impl Deserializable for FriProof
impl Deserializable for FriProof
source§fn read_from<R>(source: &mut R) -> Result<FriProof, DeserializationError>where
R: ByteReader,
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.