Skip to main content

refix_fix44/generated/messages/
market_data_request_reject.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};
5
6use super::super::components::{Header, MDRjctGrp, Trailer};
7use super::super::enums::MDReqRejReason;
8
9/// The `MarketDataRequestReject` (35=Y) message.
10pub struct MarketDataRequestReject(RawMessage);
11
12impl MarketDataRequestReject {
13    pub const MSG_TYPE: &[u8] = b"Y";
14
15    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
16        static TAGS: LazyKnownTags = LazyKnownTags::new(
17            &[Tag(262), Tag(281), Tag(816), Tag(58), Tag(354), Tag(355)],
18            &[Header::known_tags(), Trailer::known_tags(), MDRjctGrp::known_tags()],
19        );
20        &TAGS
21    }
22
23    pub fn from_raw(raw: RawMessage) -> Self {
24        Self(raw)
25    }
26
27    pub fn raw(&self) -> &RawMessage {
28        &self.0
29    }
30
31    pub fn header(&self) -> Header<'_> {
32        Header(self.0.scope(), Self::known_tags().get())
33    }
34
35    pub fn trailer(&self) -> Trailer<'_> {
36        Trailer(self.0.scope())
37    }
38
39    /// The `MDReqID` (262) field.
40    #[doc(alias = "MDReqID")]
41    pub fn md_req_id(&self) -> Result<Option<&str>, InvalidValue> {
42        self.0.get_str(Tag(262))
43    }
44
45    /// The `MDReqRejReason` (281) field.
46    #[doc(alias = "MDReqRejReason")]
47    pub fn md_req_rej_reason(&self) -> Result<Option<MDReqRejReason<'_>>, InvalidValue> {
48        Ok(self.0.get_str(Tag(281))?.map(MDReqRejReason::from_value))
49    }
50
51    /// The instances of the `NoAltMDSource` (816) group.
52    #[doc(alias = "NoAltMDSource")]
53    pub fn alt_md_source(&self) -> Result<Instances<'_, MDRjctGrp<'_>>, InvalidValue> {
54        self.0.get_group(&MDRjctGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
55    }
56
57    /// The `Text` (58) field.
58    #[doc(alias = "Text")]
59    pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
60        self.0.get_str(Tag(58))
61    }
62
63    /// The `EncodedTextLen` (354) field.
64    #[doc(alias = "EncodedTextLen")]
65    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
66        self.0.get_int(Tag(354))
67    }
68
69    /// The `EncodedText` (355) field.
70    #[doc(alias = "EncodedText")]
71    pub fn encoded_text(&self) -> Option<&[u8]> {
72        self.0.get(Tag(355))
73    }
74}
75
76impl std::fmt::Debug for MarketDataRequestReject {
77    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
78        write!(f, "MarketDataRequestReject({})", self.0)
79    }
80}
81
82impl std::fmt::Display for MarketDataRequestReject {
83    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
84        std::fmt::Display::fmt(&self.0, f)
85    }
86}