PDU

Trait PDU 

Source
pub trait PDU {
    // Required methods
    fn serialise(&self, buf: &mut BytesMut);
    fn deserialise(buffer: BytesMut) -> Result<Self, DISError>
       where Self: Sized;
    fn deserialise_without_header(
        buffer: BytesMut,
        pdu_header: PDUHeaderRecord,
    ) -> Result<Self, DISError>
       where Self: Sized;
    fn as_any(&self) -> &dyn Any;
}
Expand description

Trait to denote a PDU.

Required Methods§

Source

fn serialise(&self, buf: &mut BytesMut)

Fills a BytesMut struct with a PDU serialised into binary. This buffer is then ready to be sent via UDP to the simluation network.

Source

fn deserialise(buffer: BytesMut) -> Result<Self, DISError>
where Self: Sized,

Creates a PDU from a BytesMut struct.

Source

fn deserialise_without_header( buffer: BytesMut, pdu_header: PDUHeaderRecord, ) -> Result<Self, DISError>
where Self: Sized,

Creates a PDU from a BytesMut struct.

Source

fn as_any(&self) -> &dyn Any

Implementors§