pub trait DeserialWithState<S>: Sizedwhere
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§
Sourcefn deserial_with_state<R: Read>(state: &S, source: &mut R) -> ParseResult<Self>
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§
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.