refix-fix44 0.12.0

Typed FIX 4.4 protocol messages for the ReFIX engine
Documentation
// @generated by refix codegen from FIX44.xml. Do not edit.
#![cfg_attr(rustfmt, rustfmt::skip)]

use refix_message::{GroupTable, InvalidValue, LazyKnownTags, Tag};

use super::super::enums::StatusValue;

/// An instance of the `NoCompIDs` (936) group.
#[derive(Clone, Copy)]
pub struct CompIDStatGrp<'a>(refix_message::Scope<'a>);

impl<'a> From<refix_message::Scope<'a>> for CompIDStatGrp<'a> {
    fn from(scope: refix_message::Scope<'a>) -> Self {
        Self(scope)
    }
}

impl<'a> CompIDStatGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(936),
        Tag(930),
        &[Tag(283), Tag(284), Tag(928), Tag(929), Tag(930), Tag(931)],
        &[],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(930), Tag(931), Tag(283), Tag(284), Tag(928), Tag(929)],
            &[],
        );
        &TAGS
    }

    pub fn raw(&self) -> refix_message::Scope<'a> {
        self.0
    }

    /// The `RefCompID` (930) field.
    #[doc(alias = "RefCompID")]
    pub fn ref_comp_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(930))
    }

    /// The `RefSubID` (931) field.
    #[doc(alias = "RefSubID")]
    pub fn ref_sub_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(931))
    }

    /// The `LocationID` (283) field.
    #[doc(alias = "LocationID")]
    pub fn location_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(283))
    }

    /// The `DeskID` (284) field.
    #[doc(alias = "DeskID")]
    pub fn desk_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(284))
    }

    /// The `StatusValue` (928) field.
    #[doc(alias = "StatusValue")]
    pub fn status_value(&self) -> Result<Option<StatusValue>, InvalidValue> {
        Ok(self.0.get_int(Tag(928))?.map(StatusValue::from_value))
    }

    /// The `StatusText` (929) field.
    #[doc(alias = "StatusText")]
    pub fn status_text(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(929))
    }
}

impl std::fmt::Debug for CompIDStatGrp<'_> {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "CompIDStatGrp({})", self.0)
    }
}