[][src]Trait postcard::flavors::SerFlavor

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<(), ()> { ... } }

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

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.

Loading content...

Required methods

fn try_push(&mut self, data: u8) -> Result<(), ()>

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, ()>

The release() trait method finalizes the modification or storage operation, and resolved into the type defined by SerFlavor::Output associated type.

Loading content...

Provided methods

fn try_extend(&mut self, data: &[u8]) -> Result<(), ()>

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.

Loading content...

Implementors

impl SerFlavor for AllocVec[src]

type Output = Vec<u8>

impl SerFlavor for StdVec[src]

type Output = Vec<u8>

impl<'a> SerFlavor for Slice<'a>[src]

type Output = &'a mut [u8]

impl<'a, B> SerFlavor for Cobs<B> where
    B: SerFlavor + IndexMut<usize, Output = u8>, 
[src]

type Output = <B as SerFlavor>::Output

impl<'a, B> SerFlavor for HVec<B> where
    B: ArrayLength<u8>, 
[src]

type Output = Vec<u8, B>

Loading content...