Trait timely_communication::Serialize [] [src]

pub trait Serialize {
    fn into_bytes(&mut self, &mut Vec<u8>);
    fn from_bytes(&mut Vec<u8>) -> Self;
}

Conversions to and from Vec<u8>.

A type must implement this trait to move along the channels produced by an A: Allocate.

A default implementation is provided for any T: Abomonation+Clone.

Required Methods

fn into_bytes(&mut self, &mut Vec<u8>)

Append the binary representation of self to a vector of bytes. The &mut self argument may be mutated, but the second argument should only be appended to.

fn from_bytes(&mut Vec<u8>) -> Self

Recover an instance of Self from its binary representation. The &mut Vec<u8> argument may be taken with mem::replace if it is needed.

Implementors