pub trait PacketBody: Any + Send + Sync {
    // Required methods
    fn box_clone(&self) -> Box<dyn PacketBody>;
    fn serialize(&self) -> Result<Vec<u8>, Error>;
    fn deserialize(data: &[u8]) -> Result<Self, Error>
       where Self: Sized;
    fn id(&self) -> u8;
}
Expand description

PacketBody Implementors of this trait can be serialized into a packet body.

Required Methods§

source

fn box_clone(&self) -> Box<dyn PacketBody>

source

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

source

fn deserialize(data: &[u8]) -> Result<Self, Error>where Self: Sized,

source

fn id(&self) -> u8

Trait Implementations§

source§

impl Clone for Box<dyn PacketBody>

source§

fn clone(&self) -> Box<dyn PacketBody>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§