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::other::model::Other;
use crate::model::EntityId;

pub struct OtherBuilder(Other);

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

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

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

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

    #[must_use]
    pub fn with_origin(mut self, origin: Option<EntityId>) -> Self {
        self.0.originating_entity_id = origin;
        self
    }

    #[must_use]
    pub fn with_receiver(mut self, receiver: Option<EntityId>) -> Self {
        self.0.receiving_entity_id = receiver;
        self
    }

    #[must_use]
    pub fn with_body(mut self, body: Vec<u8>) -> Self {
        self.0.body = body;
        self
    }
}