refix_fix44/generated/components/
misc_fees_grp.rs1#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Decimal, GroupTable, InvalidValue, LazyKnownTags, Tag};
5
6use super::super::enums::{MiscFeeBasis, MiscFeeType};
7
8#[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 #[doc(alias = "MiscFeeAmt")]
40 pub fn misc_fee_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
41 self.0.get_decimal(Tag(137))
42 }
43
44 #[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 #[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 #[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}