Skip to main content

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