Skip to main content

refix_fix44/generated/components/
rfq_req_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::{QuoteRequestType, QuoteType};
7use super::{EvntGrp, InstrmtLegGrp, Instrument, SecAltIDGrp, UndInstrmtGrp};
8
9/// An instance of the `NoRelatedSym` (146) group.
10#[derive(Clone, Copy)]
11pub struct RFQReqGrp<'a>(refix_message::Scope<'a>);
12
13impl<'a> From<refix_message::Scope<'a>> for RFQReqGrp<'a> {
14    fn from(scope: refix_message::Scope<'a>) -> Self {
15        Self(scope)
16    }
17}
18
19impl<'a> RFQReqGrp<'a> {
20    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
21        Tag(146),
22        Tag(55),
23        &[
24            Tag(22), Tag(48), Tag(55), Tag(65), Tag(106), Tag(107), Tag(140), Tag(167), Tag(200),
25            Tag(201), Tag(202), Tag(206), Tag(207), Tag(223), Tag(224), Tag(225), Tag(226),
26            Tag(227), Tag(228), Tag(231), Tag(239), Tag(240), Tag(255), Tag(303), Tag(336),
27            Tag(348), Tag(349), Tag(350), Tag(351), Tag(454), Tag(460), Tag(461), Tag(470),
28            Tag(471), Tag(472), Tag(537), Tag(541), Tag(543), Tag(555), Tag(625), Tag(667),
29            Tag(691), Tag(711), Tag(762), Tag(864), Tag(873), Tag(874), Tag(875), Tag(876),
30            Tag(947),
31        ],
32        &[SecAltIDGrp::TABLE, EvntGrp::TABLE, UndInstrmtGrp::TABLE, InstrmtLegGrp::TABLE],
33    );
34
35    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
36        static TAGS: LazyKnownTags = LazyKnownTags::new(
37            &[Tag(711), Tag(555), Tag(140), Tag(303), Tag(537), Tag(336), Tag(625)],
38            &[Instrument::known_tags(), UndInstrmtGrp::known_tags(), InstrmtLegGrp::known_tags()],
39        );
40        &TAGS
41    }
42
43    pub fn raw(&self) -> refix_message::Scope<'a> {
44        self.0
45    }
46
47    /// The `Instrument` component.
48    pub fn instrument(&self) -> Instrument<'a> {
49        Instrument(self.0, Self::known_tags().get())
50    }
51
52    /// The instances of the `NoUnderlyings` (711) group.
53    #[doc(alias = "NoUnderlyings")]
54    pub fn underlyings(&self) -> Result<Instances<'a, UndInstrmtGrp<'a>>, InvalidValue> {
55        self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
56    }
57
58    /// The instances of the `NoLegs` (555) group.
59    #[doc(alias = "NoLegs")]
60    pub fn legs(&self) -> Result<Instances<'a, InstrmtLegGrp<'a>>, InvalidValue> {
61        self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
62    }
63
64    /// The `PrevClosePx` (140) field.
65    #[doc(alias = "PrevClosePx")]
66    pub fn prev_close_px(&self) -> Result<Option<Decimal>, InvalidValue> {
67        self.0.get_decimal(Tag(140))
68    }
69
70    /// The `QuoteRequestType` (303) field.
71    #[doc(alias = "QuoteRequestType")]
72    pub fn quote_request_type(&self) -> Result<Option<QuoteRequestType>, InvalidValue> {
73        Ok(self.0.get_int(Tag(303))?.map(QuoteRequestType::from_value))
74    }
75
76    /// The `QuoteType` (537) field.
77    #[doc(alias = "QuoteType")]
78    pub fn quote_type(&self) -> Result<Option<QuoteType>, InvalidValue> {
79        Ok(self.0.get_int(Tag(537))?.map(QuoteType::from_value))
80    }
81
82    /// The `TradingSessionID` (336) field.
83    #[doc(alias = "TradingSessionID")]
84    pub fn trading_session_id(&self) -> Result<Option<&'a str>, InvalidValue> {
85        self.0.get_str(Tag(336))
86    }
87
88    /// The `TradingSessionSubID` (625) field.
89    #[doc(alias = "TradingSessionSubID")]
90    pub fn trading_session_sub_id(&self) -> Result<Option<&'a str>, InvalidValue> {
91        self.0.get_str(Tag(625))
92    }
93}
94
95impl std::fmt::Debug for RFQReqGrp<'_> {
96    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
97        write!(f, "RFQReqGrp({})", self.0)
98    }
99}