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::enumerations::IsGroupOfGroupedEntityCategory;
use crate::is_group_of::model::{GroupEntityDescription, GroupReferencePoint, IsGroupOf};
use crate::model::EntityId;

pub struct IsGroupOfBuilder(IsGroupOf);

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

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

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

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

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

    #[must_use]
    pub fn with_grouped_entity_category(
        mut self,
        grouped_entity_category: IsGroupOfGroupedEntityCategory,
    ) -> Self {
        self.0.grouped_entity_category = grouped_entity_category;
        self
    }

    #[must_use]
    pub fn with_group_reference_point(
        mut self,
        group_reference_point: GroupReferencePoint,
    ) -> Self {
        self.0.group_reference_point = group_reference_point;
        self
    }

    #[must_use]
    pub fn with_description(mut self, description: GroupEntityDescription) -> Self {
        self.0.descriptions.push(description);
        self
    }

    #[must_use]
    pub fn with_descriptions(mut self, descriptions: Vec<GroupEntityDescription>) -> Self {
        self.0.descriptions = descriptions;
        self
    }
}