Trait postcard::flavors::SerFlavor [−][src]
pub trait SerFlavor {
type Output;
fn try_push(&mut self, data: u8) -> Result<(), ()>;
fn release(self) -> Result<Self::Output, ()>;
fn try_extend(&mut self, data: &[u8]) -> Result<(), ()> { ... }
fn try_push_varint_usize(&mut self, data: &VarintUsize) -> Result<(), ()> { ... }
}
Expand description
The SerFlavor trait acts as a combinator/middleware interface that can be used to pass bytes through storage or modification flavors. See the module level documentation for more information and examples.
Associated Types
Required methods
The try_push() trait method can be used to push a single byte to be modified and/or stored
Provided methods
The try_extend() trait method can be implemented when there is a more efficient way of processing multiple bytes at once, such as copying a slice to the output, rather than iterating over one byte at a time.
fn try_push_varint_usize(&mut self, data: &VarintUsize) -> Result<(), ()>
fn try_push_varint_usize(&mut self, data: &VarintUsize) -> Result<(), ()>
The try_push_varint_usize() trait method can be used to push a VarintUsize
. The default
implementation uses try_extend() to process the encoded VarintUsize
bytes, which is likely
the desired behavior for most circumstances.