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::is_part_of::model::{IsPartOf, NamedLocationId, Relationship};
use crate::model::{EntityId, EntityType, VectorF32};

pub struct IsPartOfBuilder(IsPartOf);

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

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

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

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

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

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

    #[must_use]
    pub fn with_relationship(mut self, relationship: Relationship) -> Self {
        self.0.relationship = relationship;
        self
    }

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

    #[must_use]
    pub fn with_named_location_id(mut self, named_location_id: NamedLocationId) -> Self {
        self.0.named_location_id = named_location_id;
        self
    }

    #[must_use]
    pub fn with_part_type(mut self, part_type: EntityType) -> Self {
        self.0.part_type = part_type;
        self
    }
}