Struct dis_rust::common::pdu_header_record::PDUHeaderRecord
source · [−]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
sourceimpl 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
sourceimpl Clone for PDUHeaderRecord
impl Clone for PDUHeaderRecord
sourcefn clone(&self) -> PDUHeaderRecord
fn clone(&self) -> PDUHeaderRecord
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for PDUHeaderRecord
impl Debug for PDUHeaderRecord
sourceimpl PartialEq<PDUHeaderRecord> for PDUHeaderRecord
impl PartialEq<PDUHeaderRecord> for PDUHeaderRecord
sourcefn eq(&self, other: &PDUHeaderRecord) -> bool
fn eq(&self, other: &PDUHeaderRecord) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
impl Copy for PDUHeaderRecord
impl StructuralPartialEq for PDUHeaderRecord
Auto Trait Implementations
impl RefUnwindSafe for PDUHeaderRecord
impl Send for PDUHeaderRecord
impl Sync for PDUHeaderRecord
impl Unpin for PDUHeaderRecord
impl UnwindSafe for PDUHeaderRecord
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more