Skip to main content

refix_fix42/generated/messages/
email.rs

1// @generated by refix codegen from FIX42.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{
5    Decimal, GroupTable, Instances, InvalidValue, LazyKnownTags, MonthYear, RawMessage, Tag,
6    UtcTimestamp,
7};
8
9use super::super::components::{Header, Trailer};
10use super::super::enums::{EmailType, IDSource, PutOrCall, RoutingType, SecurityType};
11
12/// The `Email` (35=C) message.
13pub struct Email(RawMessage);
14
15impl Email {
16    pub const MSG_TYPE: &[u8] = b"C";
17
18    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
19        static TAGS: LazyKnownTags = LazyKnownTags::new(
20            &[
21                Tag(164), Tag(94), Tag(42), Tag(147), Tag(356), Tag(357), Tag(215), Tag(146),
22                Tag(37), Tag(11), Tag(33), Tag(95), Tag(96),
23            ],
24            &[
25                Header::known_tags(), Trailer::known_tags(), EmailRoutingIDs::known_tags(),
26                EmailRelatedSym::known_tags(), EmailLinesOfText::known_tags(),
27            ],
28        );
29        &TAGS
30    }
31
32    pub fn from_raw(raw: RawMessage) -> Self {
33        Self(raw)
34    }
35
36    pub fn raw(&self) -> &RawMessage {
37        &self.0
38    }
39
40    pub fn header(&self) -> Header<'_> {
41        Header(self.0.scope())
42    }
43
44    pub fn trailer(&self) -> Trailer<'_> {
45        Trailer(self.0.scope())
46    }
47
48    /// The `EmailThreadID` (164) field.
49    #[doc(alias = "EmailThreadID")]
50    pub fn email_thread_id(&self) -> Result<Option<&str>, InvalidValue> {
51        self.0.get_str(Tag(164))
52    }
53
54    /// The `EmailType` (94) field.
55    #[doc(alias = "EmailType")]
56    pub fn email_type(&self) -> Result<Option<EmailType<'_>>, InvalidValue> {
57        Ok(self.0.get_str(Tag(94))?.map(EmailType::from_value))
58    }
59
60    /// The `OrigTime` (42) field.
61    #[doc(alias = "OrigTime")]
62    pub fn orig_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
63        self.0.get_utc_timestamp(Tag(42))
64    }
65
66    /// The `Subject` (147) field.
67    #[doc(alias = "Subject")]
68    pub fn subject(&self) -> Result<Option<&str>, InvalidValue> {
69        self.0.get_str(Tag(147))
70    }
71
72    /// The `EncodedSubjectLen` (356) field.
73    #[doc(alias = "EncodedSubjectLen")]
74    pub fn encoded_subject_len(&self) -> Result<Option<i64>, InvalidValue> {
75        self.0.get_int(Tag(356))
76    }
77
78    /// The `EncodedSubject` (357) field.
79    #[doc(alias = "EncodedSubject")]
80    pub fn encoded_subject(&self) -> Option<&[u8]> {
81        self.0.get(Tag(357))
82    }
83
84    /// The instances of the `NoRoutingIDs` (215) group.
85    #[doc(alias = "NoRoutingIDs")]
86    pub fn routing_ids(&self) -> Result<Instances<'_, EmailRoutingIDs<'_>>, InvalidValue> {
87        self.0.get_group(&EmailRoutingIDs::TABLE, &Self::known_tags().get()).map(Instances::from)
88    }
89
90    /// The instances of the `NoRelatedSym` (146) group.
91    #[doc(alias = "NoRelatedSym")]
92    pub fn related_sym(&self) -> Result<Instances<'_, EmailRelatedSym<'_>>, InvalidValue> {
93        self.0.get_group(&EmailRelatedSym::TABLE, &Self::known_tags().get()).map(Instances::from)
94    }
95
96    /// The `OrderID` (37) field.
97    #[doc(alias = "OrderID")]
98    pub fn order_id(&self) -> Result<Option<&str>, InvalidValue> {
99        self.0.get_str(Tag(37))
100    }
101
102    /// The `ClOrdID` (11) field.
103    #[doc(alias = "ClOrdID")]
104    pub fn cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
105        self.0.get_str(Tag(11))
106    }
107
108    /// The instances of the `LinesOfText` (33) group.
109    #[doc(alias = "LinesOfText")]
110    pub fn lines_of_text(&self) -> Result<Instances<'_, EmailLinesOfText<'_>>, InvalidValue> {
111        self.0.get_group(&EmailLinesOfText::TABLE, &Self::known_tags().get()).map(Instances::from)
112    }
113
114    /// The `RawDataLength` (95) field.
115    #[doc(alias = "RawDataLength")]
116    pub fn raw_data_length(&self) -> Result<Option<i64>, InvalidValue> {
117        self.0.get_int(Tag(95))
118    }
119
120    /// The `RawData` (96) field.
121    #[doc(alias = "RawData")]
122    pub fn raw_data(&self) -> Option<&[u8]> {
123        self.0.get(Tag(96))
124    }
125}
126
127impl std::fmt::Debug for Email {
128    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
129        write!(f, "Email({})", self.0)
130    }
131}
132
133impl std::fmt::Display for Email {
134    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
135        std::fmt::Display::fmt(&self.0, f)
136    }
137}
138
139/// An instance of the `NoRoutingIDs` (215) group.
140#[derive(Clone, Copy)]
141pub struct EmailRoutingIDs<'a>(refix_message::Scope<'a>);
142
143impl<'a> From<refix_message::Scope<'a>> for EmailRoutingIDs<'a> {
144    fn from(scope: refix_message::Scope<'a>) -> Self {
145        Self(scope)
146    }
147}
148
149impl<'a> EmailRoutingIDs<'a> {
150    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
151        Tag(215),
152        Tag(216),
153        &[Tag(216), Tag(217)],
154        &[],
155    );
156
157    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
158        static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(216), Tag(217)], &[]);
159        &TAGS
160    }
161
162    pub fn raw(&self) -> refix_message::Scope<'a> {
163        self.0
164    }
165
166    /// The `RoutingType` (216) field.
167    #[doc(alias = "RoutingType")]
168    pub fn routing_type(&self) -> Result<Option<RoutingType>, InvalidValue> {
169        Ok(self.0.get_int(Tag(216))?.map(RoutingType::from_value))
170    }
171
172    /// The `RoutingID` (217) field.
173    #[doc(alias = "RoutingID")]
174    pub fn routing_id(&self) -> Result<Option<&'a str>, InvalidValue> {
175        self.0.get_str(Tag(217))
176    }
177}
178
179impl std::fmt::Debug for EmailRoutingIDs<'_> {
180    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
181        write!(f, "EmailRoutingIDs({})", self.0)
182    }
183}
184
185/// An instance of the `NoRelatedSym` (146) group.
186#[derive(Clone, Copy)]
187pub struct EmailRelatedSym<'a>(refix_message::Scope<'a>);
188
189impl<'a> From<refix_message::Scope<'a>> for EmailRelatedSym<'a> {
190    fn from(scope: refix_message::Scope<'a>) -> Self {
191        Self(scope)
192    }
193}
194
195impl<'a> EmailRelatedSym<'a> {
196    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
197        Tag(146),
198        Tag(46),
199        &[
200            Tag(22), Tag(46), Tag(48), Tag(65), Tag(106), Tag(107), Tag(167), Tag(200), Tag(201),
201            Tag(202), Tag(205), Tag(206), Tag(207), Tag(223), Tag(231), Tag(348), Tag(349),
202            Tag(350), Tag(351),
203        ],
204        &[],
205    );
206
207    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
208        static TAGS: LazyKnownTags = LazyKnownTags::new(
209            &[
210                Tag(46), Tag(65), Tag(48), Tag(22), Tag(167), Tag(200), Tag(205), Tag(201),
211                Tag(202), Tag(206), Tag(231), Tag(223), Tag(207), Tag(106), Tag(348), Tag(349),
212                Tag(107), Tag(350), Tag(351),
213            ],
214            &[],
215        );
216        &TAGS
217    }
218
219    pub fn raw(&self) -> refix_message::Scope<'a> {
220        self.0
221    }
222
223    /// The `RelatdSym` (46) field.
224    #[doc(alias = "RelatdSym")]
225    pub fn relatd_sym(&self) -> Result<Option<&'a str>, InvalidValue> {
226        self.0.get_str(Tag(46))
227    }
228
229    /// The `SymbolSfx` (65) field.
230    #[doc(alias = "SymbolSfx")]
231    pub fn symbol_sfx(&self) -> Result<Option<&'a str>, InvalidValue> {
232        self.0.get_str(Tag(65))
233    }
234
235    /// The `SecurityID` (48) field.
236    #[doc(alias = "SecurityID")]
237    pub fn security_id(&self) -> Result<Option<&'a str>, InvalidValue> {
238        self.0.get_str(Tag(48))
239    }
240
241    /// The `IDSource` (22) field.
242    #[doc(alias = "IDSource")]
243    pub fn id_source(&self) -> Result<Option<IDSource<'a>>, InvalidValue> {
244        Ok(self.0.get_str(Tag(22))?.map(IDSource::from_value))
245    }
246
247    /// The `SecurityType` (167) field.
248    #[doc(alias = "SecurityType")]
249    pub fn security_type(&self) -> Result<Option<SecurityType<'a>>, InvalidValue> {
250        Ok(self.0.get_str(Tag(167))?.map(SecurityType::from_value))
251    }
252
253    /// The `MaturityMonthYear` (200) field.
254    #[doc(alias = "MaturityMonthYear")]
255    pub fn maturity_month_year(&self) -> Result<Option<MonthYear>, InvalidValue> {
256        self.0.get_month_year(Tag(200))
257    }
258
259    /// The `MaturityDay` (205) field.
260    #[doc(alias = "MaturityDay")]
261    pub fn maturity_day(&self) -> Result<Option<i64>, InvalidValue> {
262        self.0.get_int(Tag(205))
263    }
264
265    /// The `PutOrCall` (201) field.
266    #[doc(alias = "PutOrCall")]
267    pub fn put_or_call(&self) -> Result<Option<PutOrCall>, InvalidValue> {
268        Ok(self.0.get_int(Tag(201))?.map(PutOrCall::from_value))
269    }
270
271    /// The `StrikePrice` (202) field.
272    #[doc(alias = "StrikePrice")]
273    pub fn strike_price(&self) -> Result<Option<Decimal>, InvalidValue> {
274        self.0.get_decimal(Tag(202))
275    }
276
277    /// The `OptAttribute` (206) field.
278    #[doc(alias = "OptAttribute")]
279    pub fn opt_attribute(&self) -> Result<Option<&'a str>, InvalidValue> {
280        self.0.get_str(Tag(206))
281    }
282
283    /// The `ContractMultiplier` (231) field.
284    #[doc(alias = "ContractMultiplier")]
285    pub fn contract_multiplier(&self) -> Result<Option<Decimal>, InvalidValue> {
286        self.0.get_decimal(Tag(231))
287    }
288
289    /// The `CouponRate` (223) field.
290    #[doc(alias = "CouponRate")]
291    pub fn coupon_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
292        self.0.get_decimal(Tag(223))
293    }
294
295    /// The `SecurityExchange` (207) field.
296    #[doc(alias = "SecurityExchange")]
297    pub fn security_exchange(&self) -> Result<Option<&'a str>, InvalidValue> {
298        self.0.get_str(Tag(207))
299    }
300
301    /// The `Issuer` (106) field.
302    #[doc(alias = "Issuer")]
303    pub fn issuer(&self) -> Result<Option<&'a str>, InvalidValue> {
304        self.0.get_str(Tag(106))
305    }
306
307    /// The `EncodedIssuerLen` (348) field.
308    #[doc(alias = "EncodedIssuerLen")]
309    pub fn encoded_issuer_len(&self) -> Result<Option<i64>, InvalidValue> {
310        self.0.get_int(Tag(348))
311    }
312
313    /// The `EncodedIssuer` (349) field.
314    #[doc(alias = "EncodedIssuer")]
315    pub fn encoded_issuer(&self) -> Option<&'a [u8]> {
316        self.0.get(Tag(349))
317    }
318
319    /// The `SecurityDesc` (107) field.
320    #[doc(alias = "SecurityDesc")]
321    pub fn security_desc(&self) -> Result<Option<&'a str>, InvalidValue> {
322        self.0.get_str(Tag(107))
323    }
324
325    /// The `EncodedSecurityDescLen` (350) field.
326    #[doc(alias = "EncodedSecurityDescLen")]
327    pub fn encoded_security_desc_len(&self) -> Result<Option<i64>, InvalidValue> {
328        self.0.get_int(Tag(350))
329    }
330
331    /// The `EncodedSecurityDesc` (351) field.
332    #[doc(alias = "EncodedSecurityDesc")]
333    pub fn encoded_security_desc(&self) -> Option<&'a [u8]> {
334        self.0.get(Tag(351))
335    }
336}
337
338impl std::fmt::Debug for EmailRelatedSym<'_> {
339    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
340        write!(f, "EmailRelatedSym({})", self.0)
341    }
342}
343
344/// An instance of the `LinesOfText` (33) group.
345#[derive(Clone, Copy)]
346pub struct EmailLinesOfText<'a>(refix_message::Scope<'a>);
347
348impl<'a> From<refix_message::Scope<'a>> for EmailLinesOfText<'a> {
349    fn from(scope: refix_message::Scope<'a>) -> Self {
350        Self(scope)
351    }
352}
353
354impl<'a> EmailLinesOfText<'a> {
355    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
356        Tag(33),
357        Tag(58),
358        &[Tag(58), Tag(354), Tag(355)],
359        &[],
360    );
361
362    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
363        static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(58), Tag(354), Tag(355)], &[]);
364        &TAGS
365    }
366
367    pub fn raw(&self) -> refix_message::Scope<'a> {
368        self.0
369    }
370
371    /// The `Text` (58) field.
372    #[doc(alias = "Text")]
373    pub fn text(&self) -> Result<Option<&'a str>, InvalidValue> {
374        self.0.get_str(Tag(58))
375    }
376
377    /// The `EncodedTextLen` (354) field.
378    #[doc(alias = "EncodedTextLen")]
379    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
380        self.0.get_int(Tag(354))
381    }
382
383    /// The `EncodedText` (355) field.
384    #[doc(alias = "EncodedText")]
385    pub fn encoded_text(&self) -> Option<&'a [u8]> {
386        self.0.get(Tag(355))
387    }
388}
389
390impl std::fmt::Debug for EmailLinesOfText<'_> {
391    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
392        write!(f, "EmailLinesOfText({})", self.0)
393    }
394}