pub struct EventReportPDU {
pub pdu_header_record: PDUHeaderRecord,
pub originating_entity_id_record: EntityIDRecord,
pub receviving_entity_id_record: EntityIDRecord,
pub event_type_field: EventType,
pub padding: u32,
pub number_of_fixed_datum_records_field: u32,
pub number_of_variable_datum_records_field: u32,
pub fixed_datum_records_field: u64,
pub variable_datum_records_field: u64,
}Expand description
Event Report PDU as defined in IEEE 1278.1 standard. Used to communicate an important event during the simulation.
Fields§
§pdu_header_record: PDUHeaderRecord§originating_entity_id_record: EntityIDRecord§receviving_entity_id_record: EntityIDRecord§event_type_field: EventType§padding: u32§number_of_fixed_datum_records_field: u32§number_of_variable_datum_records_field: u32§fixed_datum_records_field: u64§variable_datum_records_field: u64Implementations§
Source§impl EventReportPDU
impl EventReportPDU
Sourcepub fn default() -> Self
pub fn default() -> Self
Provides a EventReportPDU signalling the creation of a new entity.
§Examples
Creating a blank EventReportPDU:
let event_report_pdu = EventReportPDU::default();Examples found in repository?
examples/broadcast_pdus.rs (line 35)
18fn main() {
19 let src_addr = format!("192.168.1.134:{}", SRC_PORT);
20 println!("binding to {} for sending", src_addr.as_str());
21 let socket = UdpSocket::bind(src_addr).expect("bind should succeed");
22
23 socket.set_broadcast(true).expect("set_broadcast to true should succeed");
24
25 // Send FirePDU
26 let data_to_send = FirePDU::default();
27 println!("broadcasting data: {:?}", data_to_send);
28 let mut buffer = BytesMut::new();
29 PDU::serialise(&data_to_send, &mut buffer);
30 socket
31 .send_to(&buffer, format!("255.255.255.255:{}", SRC_PORT))
32 .expect("couldn't send data");
33
34 // Send EventReportPDU
35 let data_to_send = EventReportPDU::default();
36 println!("broadcasting data: {:?}", data_to_send);
37 let mut buffer = BytesMut::new();
38 PDU::serialise(&data_to_send, &mut buffer);
39 socket
40 .send_to(&buffer, format!("255.255.255.255:{}", SRC_PORT))
41 .expect("couldn't send data");
42
43
44 // Send EntityStatePDU
45 let data_to_send = EntityStatePDU::default();
46 println!("broadcasting data: {:?}", data_to_send);
47 let mut buffer = BytesMut::new();
48 PDU::serialise(&data_to_send, &mut buffer);
49 socket
50 .send_to(&buffer, format!("255.255.255.255:{}", SRC_PORT))
51 .expect("couldn't send data");
52
53 // Send DetonationPDU
54 let data_to_send = DetonationPDU::default();
55 println!("broadcasting data: {:?}", data_to_send);
56 let mut buffer = BytesMut::new();
57 PDU::serialise(&data_to_send, &mut buffer);
58 socket
59 .send_to(&buffer, format!("255.255.255.255:{}", SRC_PORT))
60 .expect("couldn't send data");
61}Trait Implementations§
Source§impl Clone for EventReportPDU
impl Clone for EventReportPDU
Source§fn clone(&self) -> EventReportPDU
fn clone(&self) -> EventReportPDU
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 EventReportPDU
impl Debug for EventReportPDU
Source§impl PDU for EventReportPDU
impl PDU for EventReportPDU
Source§fn serialise(&self, buf: &mut BytesMut)
fn serialise(&self, buf: &mut BytesMut)
Fills a BytesMut struct with a EventReportPDU 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,
fn deserialise(buffer: BytesMut) -> Result<Self, DISError>where
Self: Sized,
Creates a PDU from a BytesMut struct.
fn as_any(&self) -> &dyn Any
Source§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.
impl Copy for EventReportPDU
Auto Trait Implementations§
impl Freeze for EventReportPDU
impl RefUnwindSafe for EventReportPDU
impl Send for EventReportPDU
impl Sync for EventReportPDU
impl Unpin for EventReportPDU
impl UnwindSafe for EventReportPDU
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