Trait Serializable

Source
pub trait Serializable {
    // Required methods
    fn size(&self) -> usize;
    fn get_bytes(&self) -> Vec<u8> ;
    fn from_bytes(
        data: &[u8],
        info: Option<SerializationInfo>,
    ) -> Result<Self, SerializationError>
       where Self: Sized;
}
Expand description

Serializable trait

Required Methods§

Source

fn size(&self) -> usize

Returns the size of the serialized data in bytes.

Source

fn get_bytes(&self) -> Vec<u8>

Serializes the data into a vector of bytes.

Source

fn from_bytes( data: &[u8], info: Option<SerializationInfo>, ) -> Result<Self, SerializationError>
where Self: Sized,

Deserializes the data from a vector of bytes.

§Arguments
  • data - slice of bytes to deserialize from
  • info - optional information about the data to deserialize, i.e. if encryption is used or not

Implementors§