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

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

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

impl<'a> LegPreAllocGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(670),
        Tag(671),
        &[Tag(671), Tag(672), Tag(673), Tag(674), Tag(675), Tag(756)],
        &[NestedParties2::TABLE],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(671), Tag(672), Tag(756), Tag(673), Tag(674), Tag(675)],
            &[NestedParties2::known_tags()],
        );
        &TAGS
    }

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

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

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

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

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

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

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

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