Skip to main content

refix_fix44/generated/components/
misc_fees_grp.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Decimal, GroupTable, InvalidValue, LazyKnownTags, Tag};
5
6use super::super::enums::{MiscFeeBasis, MiscFeeType};
7
8/// An instance of the `NoMiscFees` (136) group.
9#[derive(Clone, Copy)]
10pub struct MiscFeesGrp<'a>(refix_message::Scope<'a>);
11
12impl<'a> From<refix_message::Scope<'a>> for MiscFeesGrp<'a> {
13    fn from(scope: refix_message::Scope<'a>) -> Self {
14        Self(scope)
15    }
16}
17
18impl<'a> MiscFeesGrp<'a> {
19    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
20        Tag(136),
21        Tag(137),
22        &[Tag(137), Tag(138), Tag(139), Tag(891)],
23        &[],
24    );
25
26    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
27        static TAGS: LazyKnownTags = LazyKnownTags::new(
28            &[Tag(137), Tag(138), Tag(139), Tag(891)],
29            &[],
30        );
31        &TAGS
32    }
33
34    pub fn raw(&self) -> refix_message::Scope<'a> {
35        self.0
36    }
37
38    /// The `MiscFeeAmt` (137) field.
39    #[doc(alias = "MiscFeeAmt")]
40    pub fn misc_fee_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
41        self.0.get_decimal(Tag(137))
42    }
43
44    /// The `MiscFeeCurr` (138) field.
45    #[doc(alias = "MiscFeeCurr")]
46    pub fn misc_fee_curr(&self) -> Result<Option<&'a str>, InvalidValue> {
47        self.0.get_str(Tag(138))
48    }
49
50    /// The `MiscFeeType` (139) field.
51    #[doc(alias = "MiscFeeType")]
52    pub fn misc_fee_type(&self) -> Result<Option<MiscFeeType<'a>>, InvalidValue> {
53        Ok(self.0.get_str(Tag(139))?.map(MiscFeeType::from_value))
54    }
55
56    /// The `MiscFeeBasis` (891) field.
57    #[doc(alias = "MiscFeeBasis")]
58    pub fn misc_fee_basis(&self) -> Result<Option<MiscFeeBasis>, InvalidValue> {
59        Ok(self.0.get_int(Tag(891))?.map(MiscFeeBasis::from_value))
60    }
61}
62
63impl std::fmt::Debug for MiscFeesGrp<'_> {
64    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
65        write!(f, "MiscFeesGrp({})", self.0)
66    }
67}