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::super::enums::{OrdRejReason, OrdStatus};

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

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

impl<'a> OrdListStatGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(73),
        Tag(11),
        &[
            Tag(6), Tag(11), Tag(14), Tag(39), Tag(58), Tag(84), Tag(103), Tag(151), Tag(354),
            Tag(355), Tag(526), Tag(636),
        ],
        &[],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(11), Tag(526), Tag(14), Tag(39), Tag(636), Tag(151), Tag(84), Tag(6), Tag(103),
                Tag(58), Tag(354), Tag(355),
            ],
            &[],
        );
        &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 `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 `CumQty` (14) field.
    #[doc(alias = "CumQty")]
    pub fn cum_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(14))
    }

    /// The `OrdStatus` (39) field.
    #[doc(alias = "OrdStatus")]
    pub fn ord_status(&self) -> Result<Option<OrdStatus<'a>>, InvalidValue> {
        Ok(self.0.get_str(Tag(39))?.map(OrdStatus::from_value))
    }

    /// The `WorkingIndicator` (636) field.
    #[doc(alias = "WorkingIndicator")]
    pub fn working_indicator(&self) -> Result<Option<bool>, InvalidValue> {
        self.0.get_bool(Tag(636))
    }

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

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

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

    /// The `OrdRejReason` (103) field.
    #[doc(alias = "OrdRejReason")]
    pub fn ord_rej_reason(&self) -> Result<Option<OrdRejReason>, InvalidValue> {
        Ok(self.0.get_int(Tag(103))?.map(OrdRejReason::from_value))
    }

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

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

    /// The `EncodedText` (355) field.
    #[doc(alias = "EncodedText")]
    pub fn encoded_text(&self) -> Option<&'a [u8]> {
        self.0.get(Tag(355))
    }
}

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