[][src]Trait extindex::entry::Encodable

pub trait Encodable<T> {
    fn encode_size(item: &T) -> Option<usize>;
fn encode(item: &T, write: &mut dyn Write) -> Result<(), Error>;
fn decode(data: &mut dyn Read, size: usize) -> Result<T, Error>; }

Trait representing a structure that can be encoded / serialized to a Writer and decoded / deserialized from a Reader.

Required methods

fn encode_size(item: &T) -> Option<usize>

Exact size that the encoded item will have, if known. If none is returned, the encoding will be buffered in memory.

fn encode(item: &T, write: &mut dyn Write) -> Result<(), Error>

Encode the given item to the writer

fn decode(data: &mut dyn Read, size: usize) -> Result<T, Error>

Decode the given from the reader

Loading content...

Implementors

Loading content...