pub struct PDUHeaderRecord {
pub protocol_version: ProtocolVersion,
pub exercise_id: u8,
pub pdu_type: PDUType,
pub protocol_family: ProtocolFamily,
pub timestamp: u32,
pub length: u16,
pub padding: u16,
}
Expand description
PDU Header Record as defined in IEEE 1278.1 standard. Used to communicate PDU information during the simulation.
Fields§
§protocol_version: ProtocolVersion
§exercise_id: u8
§pdu_type: PDUType
§protocol_family: ProtocolFamily
§timestamp: u32
§length: u16
§padding: u16
Implementations§
Source§impl PDUHeaderRecord
impl PDUHeaderRecord
Sourcepub fn new(
pdu_type: PDUType,
protocol_family: ProtocolFamily,
exercise_id: u8,
length: u16,
) -> Self
pub fn new( pdu_type: PDUType, protocol_family: ProtocolFamily, exercise_id: u8, length: u16, ) -> Self
Provides a function to create a new PDUHeaderRecord. Timestamps are automatically generated using the current system time.
Sourcepub fn default(
pdu_type: PDUType,
protocol_family: ProtocolFamily,
length: u16,
) -> Self
pub fn default( pdu_type: PDUType, protocol_family: ProtocolFamily, length: u16, ) -> Self
Provides a function to create a default PDUHeaderRecord. The header uses exercise ID 1. Timestamps are automatically generated using the current system time.
Sourcepub fn calculate_dis_timestamp() -> u32
pub fn calculate_dis_timestamp() -> u32
Calculates the timestamp in DIS time units (1.68 micro-seconds) within a micro-second
Sourcepub fn serialize(&self, buf: &mut BytesMut)
pub fn serialize(&self, buf: &mut BytesMut)
Fills a BytesMut struct with a PDUHeaderRecord serialised into binary. This buffer is then ready to be sent via UDP to the simluation network.
pub fn decode(buf: &mut BytesMut) -> PDUHeaderRecord
Trait Implementations§
Source§impl Clone for PDUHeaderRecord
impl Clone for PDUHeaderRecord
Source§fn clone(&self) -> PDUHeaderRecord
fn clone(&self) -> PDUHeaderRecord
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PDUHeaderRecord
impl Debug for PDUHeaderRecord
Source§impl PartialEq for PDUHeaderRecord
impl PartialEq for PDUHeaderRecord
impl Copy for PDUHeaderRecord
impl StructuralPartialEq for PDUHeaderRecord
Auto Trait Implementations§
impl Freeze for PDUHeaderRecord
impl RefUnwindSafe for PDUHeaderRecord
impl Send for PDUHeaderRecord
impl Sync for PDUHeaderRecord
impl Unpin for PDUHeaderRecord
impl UnwindSafe for PDUHeaderRecord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more