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

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

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

impl<'a> ExecAllocGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(124),
        Tag(32),
        &[Tag(17), Tag(29), Tag(31), Tag(32), Tag(527), Tag(669)],
        &[],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(32), Tag(17), Tag(527), Tag(31), Tag(669), Tag(29)],
            &[],
        );
        &TAGS
    }

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

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

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

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

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

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

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

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