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::PartySubIDType;

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

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

impl<'a> PtysSubGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(802),
        Tag(523),
        &[Tag(523), Tag(803)],
        &[],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(523), Tag(803)], &[]);
        &TAGS
    }

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

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

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

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