Trait postcard::de_flavors::Flavor
source · pub trait Flavor<'de>: 'de {
type Remainder: 'de;
type Source: 'de;
// Required methods
fn pop(&mut self) -> Result<u8>;
fn try_take_n(&mut self, ct: usize) -> Result<&'de [u8]>;
fn finalize(self) -> Result<Self::Remainder>;
}
Expand description
The deserialization Flavor trait
This is used as the primary way to decode serialized data from some kind of buffer, or modify that data in a middleware style pattern.
See the module level docs for an example of how flavors are used.
Required Associated Types§
sourcetype Remainder: 'de
type Remainder: 'de
The remaining data of this flavor after deserializing has completed.
Typically, this includes the remaining buffer that was not used for deserialization, and in cases of more complex flavors, any additional information that was decoded or otherwise calculated during the deserialization process.
Required Methods§
sourcefn try_take_n(&mut self, ct: usize) -> Result<&'de [u8]>
fn try_take_n(&mut self, ct: usize) -> Result<&'de [u8]>
Attempt to take the next ct
bytes from the serialized message