Skip to main content

refix_fix44/generated/components/
commission_data.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Decimal, InvalidValue, LazyKnownTags, Tag};
5
6use super::super::enums::{CommType, FundRenewWaiv};
7
8/// The fields of the `CommissionData` component.
9#[derive(Clone, Copy)]
10pub struct CommissionData<'a>(pub(in super::super) refix_message::Scope<'a>);
11
12impl<'a> CommissionData<'a> {
13    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
14        static TAGS: LazyKnownTags = LazyKnownTags::new(
15            &[Tag(12), Tag(13), Tag(479), Tag(497)],
16            &[],
17        );
18        &TAGS
19    }
20
21    pub fn raw(&self) -> refix_message::Scope<'a> {
22        self.0
23    }
24
25    /// The `Commission` (12) field.
26    #[doc(alias = "Commission")]
27    pub fn commission(&self) -> Result<Option<Decimal>, InvalidValue> {
28        self.0.get_decimal(Tag(12))
29    }
30
31    /// The `CommType` (13) field.
32    #[doc(alias = "CommType")]
33    pub fn comm_type(&self) -> Result<Option<CommType<'a>>, InvalidValue> {
34        Ok(self.0.get_str(Tag(13))?.map(CommType::from_value))
35    }
36
37    /// The `CommCurrency` (479) field.
38    #[doc(alias = "CommCurrency")]
39    pub fn comm_currency(&self) -> Result<Option<&'a str>, InvalidValue> {
40        self.0.get_str(Tag(479))
41    }
42
43    /// The `FundRenewWaiv` (497) field.
44    #[doc(alias = "FundRenewWaiv")]
45    pub fn fund_renew_waiv(&self) -> Result<Option<FundRenewWaiv<'a>>, InvalidValue> {
46        Ok(self.0.get_str(Tag(497))?.map(FundRenewWaiv::from_value))
47    }
48}
49
50impl std::fmt::Debug for CommissionData<'_> {
51    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
52        write!(f, "CommissionData({})", self.0.display_known(&Self::known_tags().get()))
53    }
54}