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::{Decimal, GroupTable, Instances, InvalidValue, LazyKnownTags, Tag};

use super::NestedParties;

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

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

impl<'a> PreAllocGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(78),
        Tag(79),
        &[Tag(79), Tag(80), Tag(467), Tag(539), Tag(661), Tag(736)],
        &[NestedParties::TABLE],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(79), Tag(661), Tag(736), Tag(467), Tag(539), Tag(80)],
            &[NestedParties::known_tags()],
        );
        &TAGS
    }

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

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

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

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

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

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

    /// The `AllocQty` (80) field.
    #[doc(alias = "AllocQty")]
    pub fn alloc_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(80))
    }
}

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