Skip to main content

refix_fix44/generated/components/
cont_amt_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::ContAmtType;
7
8/// An instance of the `NoContAmts` (518) group.
9#[derive(Clone, Copy)]
10pub struct ContAmtGrp<'a>(refix_message::Scope<'a>);
11
12impl<'a> From<refix_message::Scope<'a>> for ContAmtGrp<'a> {
13    fn from(scope: refix_message::Scope<'a>) -> Self {
14        Self(scope)
15    }
16}
17
18impl<'a> ContAmtGrp<'a> {
19    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
20        Tag(518),
21        Tag(519),
22        &[Tag(519), Tag(520), Tag(521)],
23        &[],
24    );
25
26    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
27        static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(519), Tag(520), Tag(521)], &[]);
28        &TAGS
29    }
30
31    pub fn raw(&self) -> refix_message::Scope<'a> {
32        self.0
33    }
34
35    /// The `ContAmtType` (519) field.
36    #[doc(alias = "ContAmtType")]
37    pub fn cont_amt_type(&self) -> Result<Option<ContAmtType>, InvalidValue> {
38        Ok(self.0.get_int(Tag(519))?.map(ContAmtType::from_value))
39    }
40
41    /// The `ContAmtValue` (520) field.
42    #[doc(alias = "ContAmtValue")]
43    pub fn cont_amt_value(&self) -> Result<Option<Decimal>, InvalidValue> {
44        self.0.get_decimal(Tag(520))
45    }
46
47    /// The `ContAmtCurr` (521) field.
48    #[doc(alias = "ContAmtCurr")]
49    pub fn cont_amt_curr(&self) -> Result<Option<&'a str>, InvalidValue> {
50        self.0.get_str(Tag(521))
51    }
52}
53
54impl std::fmt::Debug for ContAmtGrp<'_> {
55    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
56        write!(f, "ContAmtGrp({})", self.0)
57    }
58}