Trait DeserialWithState

Source
pub trait DeserialWithState<S>: Sized
where S: HasStateApi,
{ // Required method fn deserial_with_state<R: Read>( state: &S, source: &mut R, ) -> ParseResult<Self>; }
Expand description

The DeserialWithState trait provides a means of reading structures from byte-sources (Read) for types that also need a reference to a HasStateApi type.

Types that need a reference to the state include StateBox, StateMap, StateSet, and structs or enums that contain one of these types.

Required Methods§

Source

fn deserial_with_state<R: Read>(state: &S, source: &mut R) -> ParseResult<Self>

Attempt to read a structure from a given source and state, 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", so this trait is not object safe.

Implementors§

Source§

impl<D: Deserial, S: HasStateApi> DeserialWithState<S> for D

Blanket implementation of DeserialWithState for any Deserial types, which simply does not use the state argument.

Source§

impl<K, V, S> DeserialWithState<S> for StateMap<K, V, S>
where S: HasStateApi,

Source§

impl<T, S> DeserialWithState<S> for StateBox<T, S>

Source§

impl<T, S> DeserialWithState<S> for StateSet<T, S>

Source§

impl<const M: usize, K> DeserialWithState<ExternStateApi> for StateBTreeSet<K, M>

Source§

impl<const M: usize, K, V> DeserialWithState<ExternStateApi> for StateBTreeMap<K, V, M>