Skip to main content

refix_fix44/generated/messages/
quote_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, QuotReqRjctGrp, Trailer};
7use super::super::enums::QuoteRequestRejectReason;
8
9/// The `QuoteRequestReject` (35=AG) message.
10pub struct QuoteRequestReject(RawMessage);
11
12impl QuoteRequestReject {
13    pub const MSG_TYPE: &[u8] = b"AG";
14
15    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
16        static TAGS: LazyKnownTags = LazyKnownTags::new(
17            &[Tag(131), Tag(644), Tag(658), Tag(146), Tag(58), Tag(354), Tag(355)],
18            &[Header::known_tags(), Trailer::known_tags(), QuotReqRjctGrp::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 `QuoteReqID` (131) field.
40    #[doc(alias = "QuoteReqID")]
41    pub fn quote_req_id(&self) -> Result<Option<&str>, InvalidValue> {
42        self.0.get_str(Tag(131))
43    }
44
45    /// The `RFQReqID` (644) field.
46    #[doc(alias = "RFQReqID")]
47    pub fn rfq_req_id(&self) -> Result<Option<&str>, InvalidValue> {
48        self.0.get_str(Tag(644))
49    }
50
51    /// The `QuoteRequestRejectReason` (658) field.
52    #[doc(alias = "QuoteRequestRejectReason")]
53    pub fn quote_request_reject_reason(&self) -> Result<Option<QuoteRequestRejectReason>, InvalidValue> {
54        Ok(self.0.get_int(Tag(658))?.map(QuoteRequestRejectReason::from_value))
55    }
56
57    /// The instances of the `NoRelatedSym` (146) group.
58    #[doc(alias = "NoRelatedSym")]
59    pub fn related_sym(&self) -> Result<Instances<'_, QuotReqRjctGrp<'_>>, InvalidValue> {
60        self.0.get_group(&QuotReqRjctGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
61    }
62
63    /// The `Text` (58) field.
64    #[doc(alias = "Text")]
65    pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
66        self.0.get_str(Tag(58))
67    }
68
69    /// The `EncodedTextLen` (354) field.
70    #[doc(alias = "EncodedTextLen")]
71    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
72        self.0.get_int(Tag(354))
73    }
74
75    /// The `EncodedText` (355) field.
76    #[doc(alias = "EncodedText")]
77    pub fn encoded_text(&self) -> Option<&[u8]> {
78        self.0.get(Tag(355))
79    }
80}
81
82impl std::fmt::Debug for QuoteRequestReject {
83    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
84        write!(f, "QuoteRequestReject({})", self.0)
85    }
86}
87
88impl std::fmt::Display for QuoteRequestReject {
89    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
90        std::fmt::Display::fmt(&self.0, f)
91    }
92}