pub trait PDU {
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
Fills a BytesMut struct with a PDU serialised into binary. This buffer is then ready to be sent via UDP to the simluation network.
Creates a PDU from a BytesMut struct.
fn deserialise_without_header(
buffer: BytesMut,
pdu_header: PDUHeaderRecord
) -> Result<Self, DISError> where
Self: Sized,
fn deserialise_without_header(
buffer: BytesMut,
pdu_header: PDUHeaderRecord
) -> Result<Self, DISError> where
Self: Sized,
Creates a PDU from a BytesMut struct.