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, Instances, InvalidValue, LazyKnownTags, Tag};

use super::SettlPtysSubGrp;

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

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

impl<'a> SettlParties<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(781),
        Tag(782),
        &[Tag(782), Tag(783), Tag(784), Tag(801)],
        &[SettlPtysSubGrp::TABLE],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(782), Tag(783), Tag(784), Tag(801)],
            &[SettlPtysSubGrp::known_tags()],
        );
        &TAGS
    }

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

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

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

    /// The `SettlPartyRole` (784) field.
    #[doc(alias = "SettlPartyRole")]
    pub fn settl_party_role(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(784))
    }

    /// The instances of the `NoSettlPartySubIDs` (801) group.
    #[doc(alias = "NoSettlPartySubIDs")]
    pub fn settl_party_sub_ids(&self) -> Result<Instances<'a, SettlPtysSubGrp<'a>>, InvalidValue> {
        self.0.get_group(&SettlPtysSubGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }
}

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