dis-rs 0.13.0

An implementation of the Distributed Interactive Simulation protocol (IEEE-1278.1) in Rust. This main crate contains PDU implementations and facilities to read/write PDUs from Rust data structures to the wire format and vice versa. It supports versions 6 and 7 of the protocol.
Documentation
use crate::common::model::{EntityId, RecordSpecification};
use crate::enumerations::{EventType, RequiredReliabilityService};
use crate::record_r::model::RecordR;

pub struct RecordRBuilder(RecordR);

impl Default for RecordRBuilder {
    fn default() -> Self {
        Self::new()
    }
}

impl RecordRBuilder {
    #[must_use]
    pub fn new() -> Self {
        RecordRBuilder(RecordR::default())
    }

    #[must_use]
    pub fn new_from_body(body: RecordR) -> Self {
        RecordRBuilder(body)
    }

    #[must_use]
    pub fn build(self) -> RecordR {
        self.0
    }

    #[must_use]
    pub fn with_origination_id(mut self, originating_id: EntityId) -> Self {
        self.0.originating_id = originating_id;
        self
    }

    #[must_use]
    pub fn with_receiving_id(mut self, receiving_id: EntityId) -> Self {
        self.0.receiving_id = receiving_id;
        self
    }

    #[must_use]
    pub fn with_request_id(mut self, request_id: u32) -> Self {
        self.0.request_id = request_id;
        self
    }

    #[must_use]
    pub fn with_required_reliability_service(
        mut self,
        required_reliability_service: RequiredReliabilityService,
    ) -> Self {
        self.0.required_reliability_service = required_reliability_service;
        self
    }

    #[must_use]
    pub fn with_event_type(mut self, event_type: EventType) -> Self {
        self.0.event_type = event_type;
        self
    }

    #[must_use]
    pub fn with_response_serial_number(mut self, response_serial_number: u32) -> Self {
        self.0.response_serial_number = response_serial_number;
        self
    }

    #[must_use]
    pub fn with_record_specification(mut self, record_specification: RecordSpecification) -> Self {
        self.0.record_specification = record_specification;
        self
    }
}