Trait postcard::flavors::SerFlavor [−][src]
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
type Output
[src]
The Output
type is what this flavor "resolves" to when the serialization is complete.
For storage flavors, this is typically a concrete type. For modification flavors, this is
typically a generic parameter for the storage flavor they are wrapped around.
Required methods
fn try_push(&mut self, data: u8) -> Result<(), ()>
[src]
The try_push() trait method can be used to push a single byte to be modified and/or stored
fn release(self) -> Result<Self::Output, ()>
[src]
The release() trait method finalizes the modification or storage operation, and resolved into
the type defined by SerFlavor::Output
associated type.
Provided methods
fn try_extend(&mut self, data: &[u8]) -> Result<(), ()>
[src]
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<(), ()>
[src]
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.
Implementors
impl SerFlavor for AllocVec
[src]
type Output = Vec<u8>
fn try_extend(&mut self, data: &[u8]) -> Result<(), ()>
[src]
fn try_push(&mut self, data: u8) -> Result<(), ()>
[src]
fn release(self) -> Result<Self::Output, ()>
[src]
impl SerFlavor for StdVec
[src]
type Output = Vec<u8>
fn try_extend(&mut self, data: &[u8]) -> Result<(), ()>
[src]
fn try_push(&mut self, data: u8) -> Result<(), ()>
[src]
fn release(self) -> Result<Self::Output, ()>
[src]
impl<'a> SerFlavor for Slice<'a>
[src]
type Output = &'a mut [u8]
fn try_extend(&mut self, data: &[u8]) -> Result<(), ()>
[src]
fn try_push(&mut self, data: u8) -> Result<(), ()>
[src]
fn release(self) -> Result<Self::Output, ()>
[src]
impl<'a, B> SerFlavor for Cobs<B> where
B: SerFlavor + IndexMut<usize, Output = u8>,
[src]
B: SerFlavor + IndexMut<usize, Output = u8>,
type Output = <B as SerFlavor>::Output
fn try_push(&mut self, data: u8) -> Result<(), ()>
[src]
fn release(mut self: Self) -> Result<Self::Output, ()>
[src]
impl<'a, B> SerFlavor for HVec<B> where
B: ArrayLength<u8>,
[src]
B: ArrayLength<u8>,