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::fire::model::{Fire, FireDescriptor};
use crate::model::{EntityId, EventId, Location, VectorF32};

pub struct FireBuilder(Fire);

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

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

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

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

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

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

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

    #[must_use]
    pub fn with_event_id(mut self, event_id: EventId) -> Self {
        self.0.event_id = event_id;
        self
    }

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

    #[must_use]
    pub fn with_location_in_world(mut self, location_in_world: Location) -> Self {
        self.0.location_in_world = location_in_world;
        self
    }

    #[must_use]
    pub fn with_descriptor(mut self, descriptor: FireDescriptor) -> Self {
        self.0.descriptor = descriptor;
        self
    }

    #[must_use]
    pub fn with_velocity(mut self, velocity: VectorF32) -> Self {
        self.0.velocity = velocity;
        self
    }

    #[must_use]
    pub fn with_range(mut self, range: f32) -> Self {
        self.0.range = range;
        self
    }
}