Trait Serializable

Source
pub trait Serializable {
    // Required methods
    fn serialize(&self) -> CoreResult<Vec<u8>>;
    fn deserialize(bytes: &[u8]) -> CoreResult<Self>
       where Self: Sized;
    fn type_name(&self) -> &str;
}
Expand description

Trait for serializable objects.

Required Methods§

Source

fn serialize(&self) -> CoreResult<Vec<u8>>

Serialize the object to a byte vector.

Source

fn deserialize(bytes: &[u8]) -> CoreResult<Self>
where Self: Sized,

Deserialize the object from a byte vector.

Source

fn type_name(&self) -> &str

Get the object type name.

Implementors§