Skip to main content

refix_fix44/generated/components/
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::super::enums::{
7    AllocHandlInst, AllocSettlInstType, MatchStatus, ProcessCode, SettlCurrFxRateCalc,
8};
9use super::{
10    ClrInstGrp, CommissionData, DlvyInstGrp, MiscFeesGrp, NestedParties, SettlInstructionsData,
11};
12
13/// An instance of the `NoAllocs` (78) group.
14#[derive(Clone, Copy)]
15pub struct AllocGrp<'a>(refix_message::Scope<'a>);
16
17impl<'a> From<refix_message::Scope<'a>> for AllocGrp<'a> {
18    fn from(scope: refix_message::Scope<'a>) -> Self {
19        Self(scope)
20    }
21}
22
23impl<'a> AllocGrp<'a> {
24    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
25        Tag(78),
26        Tag(79),
27        &[
28            Tag(12), Tag(13), Tag(79), Tag(80), Tag(81), Tag(85), Tag(119), Tag(120), Tag(136),
29            Tag(153), Tag(154), Tag(155), Tag(156), Tag(161), Tag(169), Tag(170), Tag(171),
30            Tag(172), Tag(208), Tag(209), Tag(360), Tag(361), Tag(366), Tag(467), Tag(479),
31            Tag(497), Tag(539), Tag(573), Tag(576), Tag(661), Tag(736), Tag(737), Tag(741),
32            Tag(742), Tag(780),
33        ],
34        &[NestedParties::TABLE, MiscFeesGrp::TABLE, ClrInstGrp::TABLE, DlvyInstGrp::TABLE],
35    );
36
37    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
38        static TAGS: LazyKnownTags = LazyKnownTags::new(
39            &[
40                Tag(79), Tag(661), Tag(573), Tag(366), Tag(80), Tag(467), Tag(81), Tag(539),
41                Tag(208), Tag(209), Tag(161), Tag(360), Tag(361), Tag(153), Tag(154), Tag(119),
42                Tag(737), Tag(120), Tag(736), Tag(155), Tag(156), Tag(742), Tag(741), Tag(136),
43                Tag(576), Tag(780),
44            ],
45            &[
46                NestedParties::known_tags(), CommissionData::known_tags(),
47                MiscFeesGrp::known_tags(), ClrInstGrp::known_tags(),
48                SettlInstructionsData::known_tags(),
49            ],
50        );
51        &TAGS
52    }
53
54    pub fn raw(&self) -> refix_message::Scope<'a> {
55        self.0
56    }
57
58    /// The `AllocAccount` (79) field.
59    #[doc(alias = "AllocAccount")]
60    pub fn alloc_account(&self) -> Result<Option<&'a str>, InvalidValue> {
61        self.0.get_str(Tag(79))
62    }
63
64    /// The `AllocAcctIDSource` (661) field.
65    #[doc(alias = "AllocAcctIDSource")]
66    pub fn alloc_acct_id_source(&self) -> Result<Option<i64>, InvalidValue> {
67        self.0.get_int(Tag(661))
68    }
69
70    /// The `MatchStatus` (573) field.
71    #[doc(alias = "MatchStatus")]
72    pub fn match_status(&self) -> Result<Option<MatchStatus<'a>>, InvalidValue> {
73        Ok(self.0.get_str(Tag(573))?.map(MatchStatus::from_value))
74    }
75
76    /// The `AllocPrice` (366) field.
77    #[doc(alias = "AllocPrice")]
78    pub fn alloc_price(&self) -> Result<Option<Decimal>, InvalidValue> {
79        self.0.get_decimal(Tag(366))
80    }
81
82    /// The `AllocQty` (80) field.
83    #[doc(alias = "AllocQty")]
84    pub fn alloc_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
85        self.0.get_decimal(Tag(80))
86    }
87
88    /// The `IndividualAllocID` (467) field.
89    #[doc(alias = "IndividualAllocID")]
90    pub fn individual_alloc_id(&self) -> Result<Option<&'a str>, InvalidValue> {
91        self.0.get_str(Tag(467))
92    }
93
94    /// The `ProcessCode` (81) field.
95    #[doc(alias = "ProcessCode")]
96    pub fn process_code(&self) -> Result<Option<ProcessCode<'a>>, InvalidValue> {
97        Ok(self.0.get_str(Tag(81))?.map(ProcessCode::from_value))
98    }
99
100    /// The instances of the `NoNestedPartyIDs` (539) group.
101    #[doc(alias = "NoNestedPartyIDs")]
102    pub fn nested_party_ids(&self) -> Result<Instances<'a, NestedParties<'a>>, InvalidValue> {
103        self.0.get_group(&NestedParties::TABLE, &Self::known_tags().get()).map(Instances::from)
104    }
105
106    /// The `NotifyBrokerOfCredit` (208) field.
107    #[doc(alias = "NotifyBrokerOfCredit")]
108    pub fn notify_broker_of_credit(&self) -> Result<Option<bool>, InvalidValue> {
109        self.0.get_bool(Tag(208))
110    }
111
112    /// The `AllocHandlInst` (209) field.
113    #[doc(alias = "AllocHandlInst")]
114    pub fn alloc_handl_inst(&self) -> Result<Option<AllocHandlInst>, InvalidValue> {
115        Ok(self.0.get_int(Tag(209))?.map(AllocHandlInst::from_value))
116    }
117
118    /// The `AllocText` (161) field.
119    #[doc(alias = "AllocText")]
120    pub fn alloc_text(&self) -> Result<Option<&'a str>, InvalidValue> {
121        self.0.get_str(Tag(161))
122    }
123
124    /// The `EncodedAllocTextLen` (360) field.
125    #[doc(alias = "EncodedAllocTextLen")]
126    pub fn encoded_alloc_text_len(&self) -> Result<Option<i64>, InvalidValue> {
127        self.0.get_int(Tag(360))
128    }
129
130    /// The `EncodedAllocText` (361) field.
131    #[doc(alias = "EncodedAllocText")]
132    pub fn encoded_alloc_text(&self) -> Option<&'a [u8]> {
133        self.0.get(Tag(361))
134    }
135
136    /// The `CommissionData` component.
137    pub fn commission_data(&self) -> CommissionData<'a> {
138        CommissionData(self.0)
139    }
140
141    /// The `AllocAvgPx` (153) field.
142    #[doc(alias = "AllocAvgPx")]
143    pub fn alloc_avg_px(&self) -> Result<Option<Decimal>, InvalidValue> {
144        self.0.get_decimal(Tag(153))
145    }
146
147    /// The `AllocNetMoney` (154) field.
148    #[doc(alias = "AllocNetMoney")]
149    pub fn alloc_net_money(&self) -> Result<Option<Decimal>, InvalidValue> {
150        self.0.get_decimal(Tag(154))
151    }
152
153    /// The `SettlCurrAmt` (119) field.
154    #[doc(alias = "SettlCurrAmt")]
155    pub fn settl_curr_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
156        self.0.get_decimal(Tag(119))
157    }
158
159    /// The `AllocSettlCurrAmt` (737) field.
160    #[doc(alias = "AllocSettlCurrAmt")]
161    pub fn alloc_settl_curr_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
162        self.0.get_decimal(Tag(737))
163    }
164
165    /// The `SettlCurrency` (120) field.
166    #[doc(alias = "SettlCurrency")]
167    pub fn settl_currency(&self) -> Result<Option<&'a str>, InvalidValue> {
168        self.0.get_str(Tag(120))
169    }
170
171    /// The `AllocSettlCurrency` (736) field.
172    #[doc(alias = "AllocSettlCurrency")]
173    pub fn alloc_settl_currency(&self) -> Result<Option<&'a str>, InvalidValue> {
174        self.0.get_str(Tag(736))
175    }
176
177    /// The `SettlCurrFxRate` (155) field.
178    #[doc(alias = "SettlCurrFxRate")]
179    pub fn settl_curr_fx_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
180        self.0.get_decimal(Tag(155))
181    }
182
183    /// The `SettlCurrFxRateCalc` (156) field.
184    #[doc(alias = "SettlCurrFxRateCalc")]
185    pub fn settl_curr_fx_rate_calc(&self) -> Result<Option<SettlCurrFxRateCalc<'a>>, InvalidValue> {
186        Ok(self.0.get_str(Tag(156))?.map(SettlCurrFxRateCalc::from_value))
187    }
188
189    /// The `AllocAccruedInterestAmt` (742) field.
190    #[doc(alias = "AllocAccruedInterestAmt")]
191    pub fn alloc_accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
192        self.0.get_decimal(Tag(742))
193    }
194
195    /// The `AllocInterestAtMaturity` (741) field.
196    #[doc(alias = "AllocInterestAtMaturity")]
197    pub fn alloc_interest_at_maturity(&self) -> Result<Option<Decimal>, InvalidValue> {
198        self.0.get_decimal(Tag(741))
199    }
200
201    /// The instances of the `NoMiscFees` (136) group.
202    #[doc(alias = "NoMiscFees")]
203    pub fn misc_fees(&self) -> Result<Instances<'a, MiscFeesGrp<'a>>, InvalidValue> {
204        self.0.get_group(&MiscFeesGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
205    }
206
207    /// The instances of the `NoClearingInstructions` (576) group.
208    #[doc(alias = "NoClearingInstructions")]
209    pub fn clearing_instructions(&self) -> Result<Instances<'a, ClrInstGrp<'a>>, InvalidValue> {
210        self.0.get_group(&ClrInstGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
211    }
212
213    /// The `AllocSettlInstType` (780) field.
214    #[doc(alias = "AllocSettlInstType")]
215    pub fn alloc_settl_inst_type(&self) -> Result<Option<AllocSettlInstType>, InvalidValue> {
216        Ok(self.0.get_int(Tag(780))?.map(AllocSettlInstType::from_value))
217    }
218
219    /// The `SettlInstructionsData` component.
220    pub fn settl_instructions_data(&self) -> SettlInstructionsData<'a> {
221        SettlInstructionsData(self.0, Self::known_tags().get())
222    }
223}
224
225impl std::fmt::Debug for AllocGrp<'_> {
226    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
227        write!(f, "AllocGrp({})", self.0)
228    }
229}