pub trait CanonicalDeserialize: Valid {
// Required method
fn deserialize_with_mode<R: Read>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Self, SerializationError>;
// Provided methods
fn deserialize_compressed<R: Read>(
reader: R,
) -> Result<Self, SerializationError> { ... }
fn deserialize_compressed_unchecked<R: Read>(
reader: R,
) -> Result<Self, SerializationError> { ... }
fn deserialize_uncompressed<R: Read>(
reader: R,
) -> Result<Self, SerializationError> { ... }
fn deserialize_uncompressed_unchecked<R: Read>(
reader: R,
) -> Result<Self, SerializationError> { ... }
}
Expand description
Deserializer in little endian format.
This trait can be derived if all fields of a struct implement
CanonicalDeserialize
and the derive
feature is enabled.
§Example
// The `derive` feature must be set for the derivation to work.
use ark_serialize::*;
#[derive(CanonicalDeserialize)]
struct TestStruct {
a: u64,
b: (u64, (u64, u64)),
}
Required Methods§
Sourcefn deserialize_with_mode<R: Read>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Self, SerializationError>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
The general deserialize method that takes in customization flags.
Provided Methods§
fn deserialize_compressed<R: Read>( reader: R, ) -> Result<Self, SerializationError>
fn deserialize_compressed_unchecked<R: Read>( reader: R, ) -> Result<Self, SerializationError>
fn deserialize_uncompressed<R: Read>( reader: R, ) -> Result<Self, SerializationError>
fn deserialize_uncompressed_unchecked<R: Read>( reader: R, ) -> Result<Self, SerializationError>
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.
Implementations on Foreign Types§
Source§impl CanonicalDeserialize for bool
impl CanonicalDeserialize for bool
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Source§impl CanonicalDeserialize for u8
impl CanonicalDeserialize for u8
fn deserialize_with_mode<R: Read>( reader: R, _compress: Compress, _validate: Validate, ) -> Result<Self, SerializationError>
Source§impl CanonicalDeserialize for u16
impl CanonicalDeserialize for u16
fn deserialize_with_mode<R: Read>( reader: R, _compress: Compress, _validate: Validate, ) -> Result<Self, SerializationError>
Source§impl CanonicalDeserialize for u32
impl CanonicalDeserialize for u32
fn deserialize_with_mode<R: Read>( reader: R, _compress: Compress, _validate: Validate, ) -> Result<Self, SerializationError>
Source§impl CanonicalDeserialize for u64
impl CanonicalDeserialize for u64
fn deserialize_with_mode<R: Read>( reader: R, _compress: Compress, _validate: Validate, ) -> Result<Self, SerializationError>
Source§impl CanonicalDeserialize for ()
impl CanonicalDeserialize for ()
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Source§impl CanonicalDeserialize for usize
impl CanonicalDeserialize for usize
fn deserialize_with_mode<R: Read>( reader: R, _compress: Compress, _validate: Validate, ) -> Result<Self, SerializationError>
Source§impl CanonicalDeserialize for String
impl CanonicalDeserialize for String
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Source§impl CanonicalDeserialize for BigUint
impl CanonicalDeserialize for BigUint
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Source§impl<'a, T> CanonicalDeserialize for Cow<'a, T>
impl<'a, T> CanonicalDeserialize for Cow<'a, T>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Source§impl<A> CanonicalDeserialize for (A,)where
A: CanonicalDeserialize,
impl<A> CanonicalDeserialize for (A,)where
A: CanonicalDeserialize,
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Source§impl<A, B> CanonicalDeserialize for (A, B)where
A: CanonicalDeserialize,
B: CanonicalDeserialize,
impl<A, B> CanonicalDeserialize for (A, B)where
A: CanonicalDeserialize,
B: CanonicalDeserialize,
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Source§impl<A, B, C> CanonicalDeserialize for (A, B, C)
impl<A, B, C> CanonicalDeserialize for (A, B, C)
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Source§impl<A, B, C, D> CanonicalDeserialize for (A, B, C, D)where
A: CanonicalDeserialize,
B: CanonicalDeserialize,
C: CanonicalDeserialize,
D: CanonicalDeserialize,
impl<A, B, C, D> CanonicalDeserialize for (A, B, C, D)where
A: CanonicalDeserialize,
B: CanonicalDeserialize,
C: CanonicalDeserialize,
D: CanonicalDeserialize,
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Source§impl<K, V> CanonicalDeserialize for BTreeMap<K, V>
impl<K, V> CanonicalDeserialize for BTreeMap<K, V>
Source§fn deserialize_with_mode<R: Read>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Self, SerializationError>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Deserializes a BTreeMap
from len(map) || key 1 || value 1 || ... || key n || value n
.
Source§impl<T: Send + Sync> CanonicalDeserialize for PhantomData<T>
impl<T: Send + Sync> CanonicalDeserialize for PhantomData<T>
fn deserialize_with_mode<R: Read>( _reader: R, _compress: Compress, _validate: Validate, ) -> Result<Self, SerializationError>
Source§impl<T: CanonicalDeserialize + ToOwned + Sync + Send> CanonicalDeserialize for Arc<T>
impl<T: CanonicalDeserialize + ToOwned + Sync + Send> CanonicalDeserialize for Arc<T>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Source§impl<T: CanonicalDeserialize> CanonicalDeserialize for Option<T>
impl<T: CanonicalDeserialize> CanonicalDeserialize for Option<T>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Source§impl<T: CanonicalDeserialize> CanonicalDeserialize for Vec<T>
impl<T: CanonicalDeserialize> CanonicalDeserialize for Vec<T>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Source§impl<T: CanonicalDeserialize, const N: usize> CanonicalDeserialize for [T; N]
impl<T: CanonicalDeserialize, const N: usize> CanonicalDeserialize for [T; N]
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Source§impl<V> CanonicalDeserialize for BTreeSet<V>where
V: Ord + CanonicalDeserialize,
impl<V> CanonicalDeserialize for BTreeSet<V>where
V: Ord + CanonicalDeserialize,
Source§fn deserialize_with_mode<R: Read>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Self, SerializationError>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>
Deserializes a BTreeSet
from len(map) || value 1 || ... || value n
.