Skip to main content

refix_fix42/generated/messages/
bid_response.rs

1// @generated by refix codegen from FIX42.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{
5    Date, Decimal, GroupTable, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag,
6};
7
8use super::super::components::{Header, Trailer};
9use super::super::enums::{CommType, NetGrossInd, PriceType, SettlmntTyp, Side};
10
11/// The `BidResponse` (35=l) message.
12pub struct BidResponse(RawMessage);
13
14impl BidResponse {
15    pub const MSG_TYPE: &[u8] = b"l";
16
17    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
18        static TAGS: LazyKnownTags = LazyKnownTags::new(
19            &[Tag(390), Tag(391), Tag(420)],
20            &[Header::known_tags(), Trailer::known_tags(), BidResponseBidComponents::known_tags()],
21        );
22        &TAGS
23    }
24
25    pub fn from_raw(raw: RawMessage) -> Self {
26        Self(raw)
27    }
28
29    pub fn raw(&self) -> &RawMessage {
30        &self.0
31    }
32
33    pub fn header(&self) -> Header<'_> {
34        Header(self.0.scope())
35    }
36
37    pub fn trailer(&self) -> Trailer<'_> {
38        Trailer(self.0.scope())
39    }
40
41    /// The `BidID` (390) field.
42    #[doc(alias = "BidID")]
43    pub fn bid_id(&self) -> Result<Option<&str>, InvalidValue> {
44        self.0.get_str(Tag(390))
45    }
46
47    /// The `ClientBidID` (391) field.
48    #[doc(alias = "ClientBidID")]
49    pub fn client_bid_id(&self) -> Result<Option<&str>, InvalidValue> {
50        self.0.get_str(Tag(391))
51    }
52
53    /// The instances of the `NoBidComponents` (420) group.
54    #[doc(alias = "NoBidComponents")]
55    pub fn bid_components(&self) -> Result<Instances<'_, BidResponseBidComponents<'_>>, InvalidValue> {
56        self.0.get_group(&BidResponseBidComponents::TABLE, &Self::known_tags().get()).map(Instances::from)
57    }
58}
59
60impl std::fmt::Debug for BidResponse {
61    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
62        write!(f, "BidResponse({})", self.0)
63    }
64}
65
66impl std::fmt::Display for BidResponse {
67    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
68        std::fmt::Display::fmt(&self.0, f)
69    }
70}
71
72/// An instance of the `NoBidComponents` (420) group.
73#[derive(Clone, Copy)]
74pub struct BidResponseBidComponents<'a>(refix_message::Scope<'a>);
75
76impl<'a> From<refix_message::Scope<'a>> for BidResponseBidComponents<'a> {
77    fn from(scope: refix_message::Scope<'a>) -> Self {
78        Self(scope)
79    }
80}
81
82impl<'a> BidResponseBidComponents<'a> {
83    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
84        Tag(420),
85        Tag(12),
86        &[
87            Tag(12), Tag(13), Tag(44), Tag(54), Tag(58), Tag(63), Tag(64), Tag(66), Tag(336),
88            Tag(354), Tag(355), Tag(406), Tag(421), Tag(423), Tag(430),
89        ],
90        &[],
91    );
92
93    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
94        static TAGS: LazyKnownTags = LazyKnownTags::new(
95            &[
96                Tag(12), Tag(13), Tag(66), Tag(421), Tag(54), Tag(44), Tag(423), Tag(406), Tag(430),
97                Tag(63), Tag(64), Tag(336), Tag(58), Tag(354), Tag(355),
98            ],
99            &[],
100        );
101        &TAGS
102    }
103
104    pub fn raw(&self) -> refix_message::Scope<'a> {
105        self.0
106    }
107
108    /// The `Commission` (12) field.
109    #[doc(alias = "Commission")]
110    pub fn commission(&self) -> Result<Option<Decimal>, InvalidValue> {
111        self.0.get_decimal(Tag(12))
112    }
113
114    /// The `CommType` (13) field.
115    #[doc(alias = "CommType")]
116    pub fn comm_type(&self) -> Result<Option<CommType<'a>>, InvalidValue> {
117        Ok(self.0.get_str(Tag(13))?.map(CommType::from_value))
118    }
119
120    /// The `ListID` (66) field.
121    #[doc(alias = "ListID")]
122    pub fn list_id(&self) -> Result<Option<&'a str>, InvalidValue> {
123        self.0.get_str(Tag(66))
124    }
125
126    /// The `Country` (421) field.
127    #[doc(alias = "Country")]
128    pub fn country(&self) -> Result<Option<&'a str>, InvalidValue> {
129        self.0.get_str(Tag(421))
130    }
131
132    /// The `Side` (54) field.
133    #[doc(alias = "Side")]
134    pub fn side(&self) -> Result<Option<Side<'a>>, InvalidValue> {
135        Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
136    }
137
138    /// The `Price` (44) field.
139    #[doc(alias = "Price")]
140    pub fn price(&self) -> Result<Option<Decimal>, InvalidValue> {
141        self.0.get_decimal(Tag(44))
142    }
143
144    /// The `PriceType` (423) field.
145    #[doc(alias = "PriceType")]
146    pub fn price_type(&self) -> Result<Option<PriceType>, InvalidValue> {
147        Ok(self.0.get_int(Tag(423))?.map(PriceType::from_value))
148    }
149
150    /// The `FairValue` (406) field.
151    #[doc(alias = "FairValue")]
152    pub fn fair_value(&self) -> Result<Option<Decimal>, InvalidValue> {
153        self.0.get_decimal(Tag(406))
154    }
155
156    /// The `NetGrossInd` (430) field.
157    #[doc(alias = "NetGrossInd")]
158    pub fn net_gross_ind(&self) -> Result<Option<NetGrossInd>, InvalidValue> {
159        Ok(self.0.get_int(Tag(430))?.map(NetGrossInd::from_value))
160    }
161
162    /// The `SettlmntTyp` (63) field.
163    #[doc(alias = "SettlmntTyp")]
164    pub fn settlmnt_typ(&self) -> Result<Option<SettlmntTyp<'a>>, InvalidValue> {
165        Ok(self.0.get_str(Tag(63))?.map(SettlmntTyp::from_value))
166    }
167
168    /// The `FutSettDate` (64) field.
169    #[doc(alias = "FutSettDate")]
170    pub fn fut_sett_date(&self) -> Result<Option<Date>, InvalidValue> {
171        self.0.get_date(Tag(64))
172    }
173
174    /// The `TradingSessionID` (336) field.
175    #[doc(alias = "TradingSessionID")]
176    pub fn trading_session_id(&self) -> Result<Option<&'a str>, InvalidValue> {
177        self.0.get_str(Tag(336))
178    }
179
180    /// The `Text` (58) field.
181    #[doc(alias = "Text")]
182    pub fn text(&self) -> Result<Option<&'a str>, InvalidValue> {
183        self.0.get_str(Tag(58))
184    }
185
186    /// The `EncodedTextLen` (354) field.
187    #[doc(alias = "EncodedTextLen")]
188    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
189        self.0.get_int(Tag(354))
190    }
191
192    /// The `EncodedText` (355) field.
193    #[doc(alias = "EncodedText")]
194    pub fn encoded_text(&self) -> Option<&'a [u8]> {
195        self.0.get(Tag(355))
196    }
197}
198
199impl std::fmt::Debug for BidResponseBidComponents<'_> {
200    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
201        write!(f, "BidResponseBidComponents({})", self.0)
202    }
203}