pub trait DeserialCtx: Sized {
    // Required method
    fn deserial_ctx<R>(
size_length: SizeLength,
ensure_ordered: bool,
source: &mut R
) -> Result<Self, ParseError>
where R: Read; }
Expand description

The DeserialCtx trait provides a means of reading structures from byte-sources (Read) using contextual information. The contextual information is:

  • size_length: The expected number of bytes used for the length of the data.
  • ensure_ordered: Whether the ordering should be ensured, for example that keys in BTreeMap and BTreeSet are in strictly increasing order.

Required Methods§

source

fn deserial_ctx<R>(
size_length: SizeLength,
ensure_ordered: bool,
source: &mut R
) -> Result<Self, ParseError>where
R: Read,

Attempt to read a structure from a given source and context, failing if an error occurs during deserialization or reading.

Implementations on Foreign Types§

source§

impl<K, V> DeserialCtx for HashMap<K, V, BuildHasherDefault<FnvHasher>, Global>where
K: Deserial + Eq + Hash,
V: Deserial,

Deserialization for HashMap given a size_len. Keys are not verified to be in any particular order and setting ensure_ordering have no effect.

source§

fn deserial_ctx<R>(
size_len: SizeLength,
_ensure_ordered: bool,
source: &mut R
) -> Result<HashMap<K, V, BuildHasherDefault<FnvHasher>, Global>, ParseError>where
R: Read,

source§

impl<K> DeserialCtx for HashSet<K, BuildHasherDefault<FnvHasher>, Global>where
K: Deserial + Eq + Hash,

Deserialization for HashSet given a size_len. Values are not verified to be in any particular order and setting ensure_ordering have no effect.

source§

fn deserial_ctx<R>(
size_len: SizeLength,
_ensure_ordered: bool,
source: &mut R
) -> Result<HashSet<K, BuildHasherDefault<FnvHasher>, Global>, ParseError>where
R: Read,

Implementors§

source§

impl DeserialCtx for String

source§

impl<K> DeserialCtx for BTreeSet<K, Global>where
K: Deserial + Ord + Copy,

source§

impl<K, V> DeserialCtx for BTreeMap<K, V, Global>where
K: Deserial + Ord + Copy,
V: Deserial,

source§

impl<T> DeserialCtx for Vec<T, Global>where
T: Deserial,