Skip to main content

refix_fix44/generated/components/
pre_alloc_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, Instances, InvalidValue, LazyKnownTags, Tag};
5
6use super::NestedParties;
7
8/// An instance of the `NoAllocs` (78) group.
9#[derive(Clone, Copy)]
10pub struct PreAllocGrp<'a>(refix_message::Scope<'a>);
11
12impl<'a> From<refix_message::Scope<'a>> for PreAllocGrp<'a> {
13    fn from(scope: refix_message::Scope<'a>) -> Self {
14        Self(scope)
15    }
16}
17
18impl<'a> PreAllocGrp<'a> {
19    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
20        Tag(78),
21        Tag(79),
22        &[Tag(79), Tag(80), Tag(467), Tag(539), Tag(661), Tag(736)],
23        &[NestedParties::TABLE],
24    );
25
26    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
27        static TAGS: LazyKnownTags = LazyKnownTags::new(
28            &[Tag(79), Tag(661), Tag(736), Tag(467), Tag(539), Tag(80)],
29            &[NestedParties::known_tags()],
30        );
31        &TAGS
32    }
33
34    pub fn raw(&self) -> refix_message::Scope<'a> {
35        self.0
36    }
37
38    /// The `AllocAccount` (79) field.
39    #[doc(alias = "AllocAccount")]
40    pub fn alloc_account(&self) -> Result<Option<&'a str>, InvalidValue> {
41        self.0.get_str(Tag(79))
42    }
43
44    /// The `AllocAcctIDSource` (661) field.
45    #[doc(alias = "AllocAcctIDSource")]
46    pub fn alloc_acct_id_source(&self) -> Result<Option<i64>, InvalidValue> {
47        self.0.get_int(Tag(661))
48    }
49
50    /// The `AllocSettlCurrency` (736) field.
51    #[doc(alias = "AllocSettlCurrency")]
52    pub fn alloc_settl_currency(&self) -> Result<Option<&'a str>, InvalidValue> {
53        self.0.get_str(Tag(736))
54    }
55
56    /// The `IndividualAllocID` (467) field.
57    #[doc(alias = "IndividualAllocID")]
58    pub fn individual_alloc_id(&self) -> Result<Option<&'a str>, InvalidValue> {
59        self.0.get_str(Tag(467))
60    }
61
62    /// The instances of the `NoNestedPartyIDs` (539) group.
63    #[doc(alias = "NoNestedPartyIDs")]
64    pub fn nested_party_ids(&self) -> Result<Instances<'a, NestedParties<'a>>, InvalidValue> {
65        self.0.get_group(&NestedParties::TABLE, &Self::known_tags().get()).map(Instances::from)
66    }
67
68    /// The `AllocQty` (80) field.
69    #[doc(alias = "AllocQty")]
70    pub fn alloc_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
71        self.0.get_decimal(Tag(80))
72    }
73}
74
75impl std::fmt::Debug for PreAllocGrp<'_> {
76    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
77        write!(f, "PreAllocGrp({})", self.0)
78    }
79}