Skip to main content

refix_fix44/generated/messages/
news.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag, UtcTimestamp};
5
6use super::super::components::{
7    Header, InstrmtGrp, InstrmtLegGrp, LinesOfTextGrp, RoutingGrp, Trailer, UndInstrmtGrp,
8};
9use super::super::enums::Urgency;
10
11/// The `News` (35=B) message.
12pub struct News(RawMessage);
13
14impl News {
15    pub const MSG_TYPE: &[u8] = b"B";
16
17    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
18        static TAGS: LazyKnownTags = LazyKnownTags::new(
19            &[
20                Tag(42), Tag(61), Tag(148), Tag(358), Tag(359), Tag(215), Tag(146), Tag(555),
21                Tag(711), Tag(33), Tag(149), Tag(95), Tag(96),
22            ],
23            &[
24                Header::known_tags(), Trailer::known_tags(), RoutingGrp::known_tags(),
25                InstrmtGrp::known_tags(), InstrmtLegGrp::known_tags(), UndInstrmtGrp::known_tags(),
26                LinesOfTextGrp::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(), Self::known_tags().get())
42    }
43
44    pub fn trailer(&self) -> Trailer<'_> {
45        Trailer(self.0.scope())
46    }
47
48    /// The `OrigTime` (42) field.
49    #[doc(alias = "OrigTime")]
50    pub fn orig_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
51        self.0.get_utc_timestamp(Tag(42))
52    }
53
54    /// The `Urgency` (61) field.
55    #[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    /// The `Headline` (148) field.
61    #[doc(alias = "Headline")]
62    pub fn headline(&self) -> Result<Option<&str>, InvalidValue> {
63        self.0.get_str(Tag(148))
64    }
65
66    /// The `EncodedHeadlineLen` (358) field.
67    #[doc(alias = "EncodedHeadlineLen")]
68    pub fn encoded_headline_len(&self) -> Result<Option<i64>, InvalidValue> {
69        self.0.get_int(Tag(358))
70    }
71
72    /// The `EncodedHeadline` (359) field.
73    #[doc(alias = "EncodedHeadline")]
74    pub fn encoded_headline(&self) -> Option<&[u8]> {
75        self.0.get(Tag(359))
76    }
77
78    /// The instances of the `NoRoutingIDs` (215) group.
79    #[doc(alias = "NoRoutingIDs")]
80    pub fn routing_ids(&self) -> Result<Instances<'_, RoutingGrp<'_>>, InvalidValue> {
81        self.0.get_group(&RoutingGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
82    }
83
84    /// The instances of the `NoRelatedSym` (146) group.
85    #[doc(alias = "NoRelatedSym")]
86    pub fn related_sym(&self) -> Result<Instances<'_, InstrmtGrp<'_>>, InvalidValue> {
87        self.0.get_group(&InstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
88    }
89
90    /// The instances of the `NoLegs` (555) group.
91    #[doc(alias = "NoLegs")]
92    pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
93        self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
94    }
95
96    /// The instances of the `NoUnderlyings` (711) group.
97    #[doc(alias = "NoUnderlyings")]
98    pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
99        self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
100    }
101
102    /// The instances of the `NoLinesOfText` (33) group.
103    #[doc(alias = "NoLinesOfText")]
104    pub fn lines_of_text(&self) -> Result<Instances<'_, LinesOfTextGrp<'_>>, InvalidValue> {
105        self.0.get_group(&LinesOfTextGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
106    }
107
108    /// The `URLLink` (149) field.
109    #[doc(alias = "URLLink")]
110    pub fn url_link(&self) -> Result<Option<&str>, InvalidValue> {
111        self.0.get_str(Tag(149))
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 News {
128    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
129        write!(f, "News({})", self.0)
130    }
131}
132
133impl std::fmt::Display for News {
134    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
135        std::fmt::Display::fmt(&self.0, f)
136    }
137}