Serializable

Trait Serializable 

Source
pub trait Serializable
where Self: Sized,
{ // Required methods fn serialize(&self) -> Result<Vec<u8>, Error>; fn deserialize<R: Read>(reader: &mut R) -> Result<Self, DecodeError>; }
Expand description

Trait used to de/serialize an object to/from a vector of bytes.

Required Methods§

Source

fn serialize(&self) -> Result<Vec<u8>, Error>

Serialize the object.

Source

fn deserialize<R: Read>(reader: &mut R) -> Result<Self, DecodeError>

Deserialize the object.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> Serializable for T
where T: Writeable + Readable,