Skip to main content

refix_fix44/generated/components/
leg_ord_grp.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Date, Decimal, GroupTable, Instances, InvalidValue, LazyKnownTags, Tag};
5
6use super::super::enums::LegSwapType;
7use super::{InstrumentLeg, LegPreAllocGrp, LegSecAltIDGrp, LegStipulations, NestedParties};
8
9/// An instance of the `NoLegs` (555) group.
10#[derive(Clone, Copy)]
11pub struct LegOrdGrp<'a>(refix_message::Scope<'a>);
12
13impl<'a> From<refix_message::Scope<'a>> for LegOrdGrp<'a> {
14    fn from(scope: refix_message::Scope<'a>) -> Self {
15        Self(scope)
16    }
17}
18
19impl<'a> LegOrdGrp<'a> {
20    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
21        Tag(555),
22        Tag(600),
23        &[
24            Tag(248), Tag(249), Tag(250), Tag(251), Tag(252), Tag(253), Tag(254), Tag(257),
25            Tag(539), Tag(556), Tag(564), Tag(565), Tag(566), Tag(587), Tag(588), Tag(596),
26            Tag(597), Tag(598), Tag(599), Tag(600), Tag(601), Tag(602), Tag(603), Tag(604),
27            Tag(607), Tag(608), Tag(609), Tag(610), Tag(611), Tag(612), Tag(613), Tag(614),
28            Tag(615), Tag(616), Tag(617), Tag(618), Tag(619), Tag(620), Tag(621), Tag(622),
29            Tag(623), Tag(624), Tag(654), Tag(670), Tag(683), Tag(687), Tag(690), Tag(739),
30            Tag(740), Tag(764), Tag(942), Tag(955), Tag(956),
31        ],
32        &[
33            LegSecAltIDGrp::TABLE, LegStipulations::TABLE, LegPreAllocGrp::TABLE,
34            NestedParties::TABLE,
35        ],
36    );
37
38    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
39        static TAGS: LazyKnownTags = LazyKnownTags::new(
40            &[
41                Tag(687), Tag(690), Tag(683), Tag(670), Tag(564), Tag(565), Tag(539), Tag(654),
42                Tag(566), Tag(587), Tag(588),
43            ],
44            &[
45                InstrumentLeg::known_tags(), LegStipulations::known_tags(),
46                LegPreAllocGrp::known_tags(), NestedParties::known_tags(),
47            ],
48        );
49        &TAGS
50    }
51
52    pub fn raw(&self) -> refix_message::Scope<'a> {
53        self.0
54    }
55
56    /// The `InstrumentLeg` component.
57    pub fn instrument_leg(&self) -> InstrumentLeg<'a> {
58        InstrumentLeg(self.0, Self::known_tags().get())
59    }
60
61    /// The `LegQty` (687) field.
62    #[doc(alias = "LegQty")]
63    pub fn leg_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
64        self.0.get_decimal(Tag(687))
65    }
66
67    /// The `LegSwapType` (690) field.
68    #[doc(alias = "LegSwapType")]
69    pub fn leg_swap_type(&self) -> Result<Option<LegSwapType>, InvalidValue> {
70        Ok(self.0.get_int(Tag(690))?.map(LegSwapType::from_value))
71    }
72
73    /// The instances of the `NoLegStipulations` (683) group.
74    #[doc(alias = "NoLegStipulations")]
75    pub fn leg_stipulations(&self) -> Result<Instances<'a, LegStipulations<'a>>, InvalidValue> {
76        self.0.get_group(&LegStipulations::TABLE, &Self::known_tags().get()).map(Instances::from)
77    }
78
79    /// The instances of the `NoLegAllocs` (670) group.
80    #[doc(alias = "NoLegAllocs")]
81    pub fn leg_allocs(&self) -> Result<Instances<'a, LegPreAllocGrp<'a>>, InvalidValue> {
82        self.0.get_group(&LegPreAllocGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
83    }
84
85    /// The `LegPositionEffect` (564) field.
86    #[doc(alias = "LegPositionEffect")]
87    pub fn leg_position_effect(&self) -> Result<Option<&'a str>, InvalidValue> {
88        self.0.get_str(Tag(564))
89    }
90
91    /// The `LegCoveredOrUncovered` (565) field.
92    #[doc(alias = "LegCoveredOrUncovered")]
93    pub fn leg_covered_or_uncovered(&self) -> Result<Option<i64>, InvalidValue> {
94        self.0.get_int(Tag(565))
95    }
96
97    /// The instances of the `NoNestedPartyIDs` (539) group.
98    #[doc(alias = "NoNestedPartyIDs")]
99    pub fn nested_party_ids(&self) -> Result<Instances<'a, NestedParties<'a>>, InvalidValue> {
100        self.0.get_group(&NestedParties::TABLE, &Self::known_tags().get()).map(Instances::from)
101    }
102
103    /// The `LegRefID` (654) field.
104    #[doc(alias = "LegRefID")]
105    pub fn leg_ref_id(&self) -> Result<Option<&'a str>, InvalidValue> {
106        self.0.get_str(Tag(654))
107    }
108
109    /// The `LegPrice` (566) field.
110    #[doc(alias = "LegPrice")]
111    pub fn leg_price(&self) -> Result<Option<Decimal>, InvalidValue> {
112        self.0.get_decimal(Tag(566))
113    }
114
115    /// The `LegSettlType` (587) field.
116    #[doc(alias = "LegSettlType")]
117    pub fn leg_settl_type(&self) -> Result<Option<&'a str>, InvalidValue> {
118        self.0.get_str(Tag(587))
119    }
120
121    /// The `LegSettlDate` (588) field.
122    #[doc(alias = "LegSettlDate")]
123    pub fn leg_settl_date(&self) -> Result<Option<Date>, InvalidValue> {
124        self.0.get_date(Tag(588))
125    }
126}
127
128impl std::fmt::Debug for LegOrdGrp<'_> {
129    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
130        write!(f, "LegOrdGrp({})", self.0)
131    }
132}