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

use super::{UndSecAltIDGrp, UnderlyingInstrument, UnderlyingStipulations};

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

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

impl<'a> PosUndInstrmtGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(711),
        Tag(311),
        &[
            Tag(241), Tag(242), Tag(243), Tag(244), Tag(245), Tag(246), Tag(247), Tag(256),
            Tag(305), Tag(306), Tag(307), Tag(308), Tag(309), Tag(310), Tag(311), Tag(312),
            Tag(313), Tag(315), Tag(316), Tag(317), Tag(318), Tag(362), Tag(363), Tag(364),
            Tag(365), Tag(435), Tag(436), Tag(457), Tag(462), Tag(463), Tag(542), Tag(592),
            Tag(593), Tag(594), Tag(595), Tag(732), Tag(733), Tag(763), Tag(810), Tag(877),
            Tag(878), Tag(879), Tag(882), Tag(883), Tag(884), Tag(885), Tag(886), Tag(887),
            Tag(941),
        ],
        &[UndSecAltIDGrp::TABLE, UnderlyingStipulations::TABLE],
    );

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

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

    /// The `UnderlyingInstrument` component.
    pub fn underlying_instrument(&self) -> UnderlyingInstrument<'a> {
        UnderlyingInstrument(self.0, Self::known_tags().get())
    }

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

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

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