refix_fix42/generated/messages/
news.rs1#![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::{IDSource, PutOrCall, RoutingType, SecurityType, Urgency};
11
12pub struct News(RawMessage);
14
15impl News {
16 pub const MSG_TYPE: &[u8] = b"B";
17
18 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
19 static TAGS: LazyKnownTags = LazyKnownTags::new(
20 &[
21 Tag(42), Tag(61), Tag(148), Tag(358), Tag(359), Tag(215), Tag(146), Tag(33),
22 Tag(149), Tag(95), Tag(96),
23 ],
24 &[
25 Header::known_tags(), Trailer::known_tags(), NewsRoutingIDs::known_tags(),
26 NewsRelatedSym::known_tags(), NewsLinesOfText::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 #[doc(alias = "OrigTime")]
50 pub fn orig_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
51 self.0.get_utc_timestamp(Tag(42))
52 }
53
54 #[doc(alias = "Urgency")]
56 pub fn urgency(&self) -> Result<Option<Urgency<'_>>, InvalidValue> {
57 Ok(self.0.get_str(Tag(61))?.map(Urgency::from_value))
58 }
59
60 #[doc(alias = "Headline")]
62 pub fn headline(&self) -> Result<Option<&str>, InvalidValue> {
63 self.0.get_str(Tag(148))
64 }
65
66 #[doc(alias = "EncodedHeadlineLen")]
68 pub fn encoded_headline_len(&self) -> Result<Option<i64>, InvalidValue> {
69 self.0.get_int(Tag(358))
70 }
71
72 #[doc(alias = "EncodedHeadline")]
74 pub fn encoded_headline(&self) -> Option<&[u8]> {
75 self.0.get(Tag(359))
76 }
77
78 #[doc(alias = "NoRoutingIDs")]
80 pub fn routing_ids(&self) -> Result<Instances<'_, NewsRoutingIDs<'_>>, InvalidValue> {
81 self.0.get_group(&NewsRoutingIDs::TABLE, &Self::known_tags().get()).map(Instances::from)
82 }
83
84 #[doc(alias = "NoRelatedSym")]
86 pub fn related_sym(&self) -> Result<Instances<'_, NewsRelatedSym<'_>>, InvalidValue> {
87 self.0.get_group(&NewsRelatedSym::TABLE, &Self::known_tags().get()).map(Instances::from)
88 }
89
90 #[doc(alias = "LinesOfText")]
92 pub fn lines_of_text(&self) -> Result<Instances<'_, NewsLinesOfText<'_>>, InvalidValue> {
93 self.0.get_group(&NewsLinesOfText::TABLE, &Self::known_tags().get()).map(Instances::from)
94 }
95
96 #[doc(alias = "URLLink")]
98 pub fn url_link(&self) -> Result<Option<&str>, InvalidValue> {
99 self.0.get_str(Tag(149))
100 }
101
102 #[doc(alias = "RawDataLength")]
104 pub fn raw_data_length(&self) -> Result<Option<i64>, InvalidValue> {
105 self.0.get_int(Tag(95))
106 }
107
108 #[doc(alias = "RawData")]
110 pub fn raw_data(&self) -> Option<&[u8]> {
111 self.0.get(Tag(96))
112 }
113}
114
115impl std::fmt::Debug for News {
116 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
117 write!(f, "News({})", self.0)
118 }
119}
120
121impl std::fmt::Display for News {
122 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
123 std::fmt::Display::fmt(&self.0, f)
124 }
125}
126
127#[derive(Clone, Copy)]
129pub struct NewsRoutingIDs<'a>(refix_message::Scope<'a>);
130
131impl<'a> From<refix_message::Scope<'a>> for NewsRoutingIDs<'a> {
132 fn from(scope: refix_message::Scope<'a>) -> Self {
133 Self(scope)
134 }
135}
136
137impl<'a> NewsRoutingIDs<'a> {
138 pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
139 Tag(215),
140 Tag(216),
141 &[Tag(216), Tag(217)],
142 &[],
143 );
144
145 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
146 static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(216), Tag(217)], &[]);
147 &TAGS
148 }
149
150 pub fn raw(&self) -> refix_message::Scope<'a> {
151 self.0
152 }
153
154 #[doc(alias = "RoutingType")]
156 pub fn routing_type(&self) -> Result<Option<RoutingType>, InvalidValue> {
157 Ok(self.0.get_int(Tag(216))?.map(RoutingType::from_value))
158 }
159
160 #[doc(alias = "RoutingID")]
162 pub fn routing_id(&self) -> Result<Option<&'a str>, InvalidValue> {
163 self.0.get_str(Tag(217))
164 }
165}
166
167impl std::fmt::Debug for NewsRoutingIDs<'_> {
168 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
169 write!(f, "NewsRoutingIDs({})", self.0)
170 }
171}
172
173#[derive(Clone, Copy)]
175pub struct NewsRelatedSym<'a>(refix_message::Scope<'a>);
176
177impl<'a> From<refix_message::Scope<'a>> for NewsRelatedSym<'a> {
178 fn from(scope: refix_message::Scope<'a>) -> Self {
179 Self(scope)
180 }
181}
182
183impl<'a> NewsRelatedSym<'a> {
184 pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
185 Tag(146),
186 Tag(46),
187 &[
188 Tag(22), Tag(46), Tag(48), Tag(65), Tag(106), Tag(107), Tag(167), Tag(200), Tag(201),
189 Tag(202), Tag(205), Tag(206), Tag(207), Tag(223), Tag(231), Tag(348), Tag(349),
190 Tag(350), Tag(351),
191 ],
192 &[],
193 );
194
195 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
196 static TAGS: LazyKnownTags = LazyKnownTags::new(
197 &[
198 Tag(46), Tag(65), Tag(48), Tag(22), Tag(167), Tag(200), Tag(205), Tag(201),
199 Tag(202), Tag(206), Tag(231), Tag(223), Tag(207), Tag(106), Tag(348), Tag(349),
200 Tag(107), Tag(350), Tag(351),
201 ],
202 &[],
203 );
204 &TAGS
205 }
206
207 pub fn raw(&self) -> refix_message::Scope<'a> {
208 self.0
209 }
210
211 #[doc(alias = "RelatdSym")]
213 pub fn relatd_sym(&self) -> Result<Option<&'a str>, InvalidValue> {
214 self.0.get_str(Tag(46))
215 }
216
217 #[doc(alias = "SymbolSfx")]
219 pub fn symbol_sfx(&self) -> Result<Option<&'a str>, InvalidValue> {
220 self.0.get_str(Tag(65))
221 }
222
223 #[doc(alias = "SecurityID")]
225 pub fn security_id(&self) -> Result<Option<&'a str>, InvalidValue> {
226 self.0.get_str(Tag(48))
227 }
228
229 #[doc(alias = "IDSource")]
231 pub fn id_source(&self) -> Result<Option<IDSource<'a>>, InvalidValue> {
232 Ok(self.0.get_str(Tag(22))?.map(IDSource::from_value))
233 }
234
235 #[doc(alias = "SecurityType")]
237 pub fn security_type(&self) -> Result<Option<SecurityType<'a>>, InvalidValue> {
238 Ok(self.0.get_str(Tag(167))?.map(SecurityType::from_value))
239 }
240
241 #[doc(alias = "MaturityMonthYear")]
243 pub fn maturity_month_year(&self) -> Result<Option<MonthYear>, InvalidValue> {
244 self.0.get_month_year(Tag(200))
245 }
246
247 #[doc(alias = "MaturityDay")]
249 pub fn maturity_day(&self) -> Result<Option<i64>, InvalidValue> {
250 self.0.get_int(Tag(205))
251 }
252
253 #[doc(alias = "PutOrCall")]
255 pub fn put_or_call(&self) -> Result<Option<PutOrCall>, InvalidValue> {
256 Ok(self.0.get_int(Tag(201))?.map(PutOrCall::from_value))
257 }
258
259 #[doc(alias = "StrikePrice")]
261 pub fn strike_price(&self) -> Result<Option<Decimal>, InvalidValue> {
262 self.0.get_decimal(Tag(202))
263 }
264
265 #[doc(alias = "OptAttribute")]
267 pub fn opt_attribute(&self) -> Result<Option<&'a str>, InvalidValue> {
268 self.0.get_str(Tag(206))
269 }
270
271 #[doc(alias = "ContractMultiplier")]
273 pub fn contract_multiplier(&self) -> Result<Option<Decimal>, InvalidValue> {
274 self.0.get_decimal(Tag(231))
275 }
276
277 #[doc(alias = "CouponRate")]
279 pub fn coupon_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
280 self.0.get_decimal(Tag(223))
281 }
282
283 #[doc(alias = "SecurityExchange")]
285 pub fn security_exchange(&self) -> Result<Option<&'a str>, InvalidValue> {
286 self.0.get_str(Tag(207))
287 }
288
289 #[doc(alias = "Issuer")]
291 pub fn issuer(&self) -> Result<Option<&'a str>, InvalidValue> {
292 self.0.get_str(Tag(106))
293 }
294
295 #[doc(alias = "EncodedIssuerLen")]
297 pub fn encoded_issuer_len(&self) -> Result<Option<i64>, InvalidValue> {
298 self.0.get_int(Tag(348))
299 }
300
301 #[doc(alias = "EncodedIssuer")]
303 pub fn encoded_issuer(&self) -> Option<&'a [u8]> {
304 self.0.get(Tag(349))
305 }
306
307 #[doc(alias = "SecurityDesc")]
309 pub fn security_desc(&self) -> Result<Option<&'a str>, InvalidValue> {
310 self.0.get_str(Tag(107))
311 }
312
313 #[doc(alias = "EncodedSecurityDescLen")]
315 pub fn encoded_security_desc_len(&self) -> Result<Option<i64>, InvalidValue> {
316 self.0.get_int(Tag(350))
317 }
318
319 #[doc(alias = "EncodedSecurityDesc")]
321 pub fn encoded_security_desc(&self) -> Option<&'a [u8]> {
322 self.0.get(Tag(351))
323 }
324}
325
326impl std::fmt::Debug for NewsRelatedSym<'_> {
327 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
328 write!(f, "NewsRelatedSym({})", self.0)
329 }
330}
331
332#[derive(Clone, Copy)]
334pub struct NewsLinesOfText<'a>(refix_message::Scope<'a>);
335
336impl<'a> From<refix_message::Scope<'a>> for NewsLinesOfText<'a> {
337 fn from(scope: refix_message::Scope<'a>) -> Self {
338 Self(scope)
339 }
340}
341
342impl<'a> NewsLinesOfText<'a> {
343 pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
344 Tag(33),
345 Tag(58),
346 &[Tag(58), Tag(354), Tag(355)],
347 &[],
348 );
349
350 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
351 static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(58), Tag(354), Tag(355)], &[]);
352 &TAGS
353 }
354
355 pub fn raw(&self) -> refix_message::Scope<'a> {
356 self.0
357 }
358
359 #[doc(alias = "Text")]
361 pub fn text(&self) -> Result<Option<&'a str>, InvalidValue> {
362 self.0.get_str(Tag(58))
363 }
364
365 #[doc(alias = "EncodedTextLen")]
367 pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
368 self.0.get_int(Tag(354))
369 }
370
371 #[doc(alias = "EncodedText")]
373 pub fn encoded_text(&self) -> Option<&'a [u8]> {
374 self.0.get(Tag(355))
375 }
376}
377
378impl std::fmt::Debug for NewsLinesOfText<'_> {
379 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
380 write!(f, "NewsLinesOfText({})", self.0)
381 }
382}