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 `NoOrders` (73) group.
#[derive(Clone, Copy)]
pub struct OrdAllocGrp<'a>(refix_message::Scope<'a>);

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

impl<'a> OrdAllocGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(73),
        Tag(11),
        &[Tag(11), Tag(37), Tag(38), Tag(66), Tag(198), Tag(526), Tag(756), Tag(799), Tag(800)],
        &[NestedParties2::TABLE],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(11), Tag(37), Tag(198), Tag(526), Tag(66), Tag(756), Tag(38), Tag(799), Tag(800)],
            &[NestedParties2::known_tags()],
        );
        &TAGS
    }

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

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

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

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

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

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

    /// 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 `OrderQty` (38) field.
    #[doc(alias = "OrderQty")]
    pub fn order_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(38))
    }

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

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

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