refix_fix44/generated/messages/
quote_request.rs1#![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
9pub 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 #[doc(alias = "QuoteReqID")]
41 pub fn quote_req_id(&self) -> Result<Option<&str>, InvalidValue> {
42 self.0.get_str(Tag(131))
43 }
44
45 #[doc(alias = "RFQReqID")]
47 pub fn rfq_req_id(&self) -> Result<Option<&str>, InvalidValue> {
48 self.0.get_str(Tag(644))
49 }
50
51 #[doc(alias = "ClOrdID")]
53 pub fn cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
54 self.0.get_str(Tag(11))
55 }
56
57 #[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 #[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 #[doc(alias = "Text")]
71 pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
72 self.0.get_str(Tag(58))
73 }
74
75 #[doc(alias = "EncodedTextLen")]
77 pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
78 self.0.get_int(Tag(354))
79 }
80
81 #[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}