refix_fix44/generated/components/
trd_instrmt_leg_grp.rs1#![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, LegSecAltIDGrp, LegStipulations, NestedParties};
8
9#[derive(Clone, Copy)]
11pub struct TrdInstrmtLegGrp<'a>(refix_message::Scope<'a>);
12
13impl<'a> From<refix_message::Scope<'a>> for TrdInstrmtLegGrp<'a> {
14 fn from(scope: refix_message::Scope<'a>) -> Self {
15 Self(scope)
16 }
17}
18
19impl<'a> TrdInstrmtLegGrp<'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(637), Tag(654), Tag(683), Tag(687), Tag(690), Tag(739),
30 Tag(740), Tag(764), Tag(942), Tag(955), Tag(956),
31 ],
32 &[LegSecAltIDGrp::TABLE, LegStipulations::TABLE, NestedParties::TABLE],
33 );
34
35 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
36 static TAGS: LazyKnownTags = LazyKnownTags::new(
37 &[
38 Tag(687), Tag(690), Tag(683), Tag(564), Tag(565), Tag(539), Tag(654), Tag(566),
39 Tag(587), Tag(588), Tag(637),
40 ],
41 &[
42 InstrumentLeg::known_tags(), LegStipulations::known_tags(),
43 NestedParties::known_tags(),
44 ],
45 );
46 &TAGS
47 }
48
49 pub fn raw(&self) -> refix_message::Scope<'a> {
50 self.0
51 }
52
53 pub fn instrument_leg(&self) -> InstrumentLeg<'a> {
55 InstrumentLeg(self.0, Self::known_tags().get())
56 }
57
58 #[doc(alias = "LegQty")]
60 pub fn leg_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
61 self.0.get_decimal(Tag(687))
62 }
63
64 #[doc(alias = "LegSwapType")]
66 pub fn leg_swap_type(&self) -> Result<Option<LegSwapType>, InvalidValue> {
67 Ok(self.0.get_int(Tag(690))?.map(LegSwapType::from_value))
68 }
69
70 #[doc(alias = "NoLegStipulations")]
72 pub fn leg_stipulations(&self) -> Result<Instances<'a, LegStipulations<'a>>, InvalidValue> {
73 self.0.get_group(&LegStipulations::TABLE, &Self::known_tags().get()).map(Instances::from)
74 }
75
76 #[doc(alias = "LegPositionEffect")]
78 pub fn leg_position_effect(&self) -> Result<Option<&'a str>, InvalidValue> {
79 self.0.get_str(Tag(564))
80 }
81
82 #[doc(alias = "LegCoveredOrUncovered")]
84 pub fn leg_covered_or_uncovered(&self) -> Result<Option<i64>, InvalidValue> {
85 self.0.get_int(Tag(565))
86 }
87
88 #[doc(alias = "NoNestedPartyIDs")]
90 pub fn nested_party_ids(&self) -> Result<Instances<'a, NestedParties<'a>>, InvalidValue> {
91 self.0.get_group(&NestedParties::TABLE, &Self::known_tags().get()).map(Instances::from)
92 }
93
94 #[doc(alias = "LegRefID")]
96 pub fn leg_ref_id(&self) -> Result<Option<&'a str>, InvalidValue> {
97 self.0.get_str(Tag(654))
98 }
99
100 #[doc(alias = "LegPrice")]
102 pub fn leg_price(&self) -> Result<Option<Decimal>, InvalidValue> {
103 self.0.get_decimal(Tag(566))
104 }
105
106 #[doc(alias = "LegSettlType")]
108 pub fn leg_settl_type(&self) -> Result<Option<&'a str>, InvalidValue> {
109 self.0.get_str(Tag(587))
110 }
111
112 #[doc(alias = "LegSettlDate")]
114 pub fn leg_settl_date(&self) -> Result<Option<Date>, InvalidValue> {
115 self.0.get_date(Tag(588))
116 }
117
118 #[doc(alias = "LegLastPx")]
120 pub fn leg_last_px(&self) -> Result<Option<Decimal>, InvalidValue> {
121 self.0.get_decimal(Tag(637))
122 }
123}
124
125impl std::fmt::Debug for TrdInstrmtLegGrp<'_> {
126 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
127 write!(f, "TrdInstrmtLegGrp({})", self.0)
128 }
129}