Trait ark_serialize::CanonicalDeserialize
source · 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>
Implementations on Foreign Types§
source§impl<'a, T> CanonicalDeserialize for Cow<'a, T>where
T: ToOwned + Valid + Sync + Send,
<T as ToOwned>::Owned: CanonicalDeserialize + Valid + Send,
impl<'a, T> CanonicalDeserialize for Cow<'a, T>where T: ToOwned + Valid + Sync + Send, <T as ToOwned>::Owned: CanonicalDeserialize + Valid + Send,
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 u16
impl CanonicalDeserialize for u16
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<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 CanonicalDeserialize for BigUint
impl CanonicalDeserialize for BigUint
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 String
impl CanonicalDeserialize for String
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate ) -> Result<Self, SerializationError>
source§impl<K, V> CanonicalDeserialize for BTreeMap<K, V>where
K: Ord + CanonicalDeserialize,
V: CanonicalDeserialize,
impl<K, V> CanonicalDeserialize for BTreeMap<K, V>where K: Ord + CanonicalDeserialize, V: 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 BTreeMap
from len(map) || key 1 || value 1 || ... || key n || value n
.
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<A, B, C> CanonicalDeserialize for (A, B, C)where
A: CanonicalDeserialize,
B: CanonicalDeserialize,
C: CanonicalDeserialize,
impl<A, B, C> CanonicalDeserialize for (A, B, C)where A: CanonicalDeserialize, B: CanonicalDeserialize, C: CanonicalDeserialize,
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 CanonicalDeserialize for u32
impl CanonicalDeserialize for u32
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: 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<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
.