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::{MiscFeeBasis, MiscFeeType};

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

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

impl<'a> MiscFeesGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(136),
        Tag(137),
        &[Tag(137), Tag(138), Tag(139), Tag(891)],
        &[],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(137), Tag(138), Tag(139), Tag(891)],
            &[],
        );
        &TAGS
    }

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

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

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

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

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

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