Skip to main content

DeserialCtx

Trait DeserialCtx 

Source
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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<K, V> DeserialCtx for HashMap<K, V, BuildHasherDefault<FnvHasher>>
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>>, ParseError>
where R: Read,

Source§

impl<K> DeserialCtx for HashSet<K, BuildHasherDefault<FnvHasher>>
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>>, ParseError>
where R: Read,

Implementors§

Source§

impl DeserialCtx for String

Source§

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

Source§

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

Source§

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