refix_fix44/generated/messages/
dont_know_trade.rs1#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Decimal, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};
5
6use super::super::components::{
7 Header, InstrmtLegGrp, Instrument, OrderQtyData, Trailer, UndInstrmtGrp,
8};
9use super::super::enums::{DKReason, Side};
10
11pub struct DontKnowTrade(RawMessage);
13
14impl DontKnowTrade {
15 pub const MSG_TYPE: &[u8] = b"Q";
16
17 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
18 static TAGS: LazyKnownTags = LazyKnownTags::new(
19 &[
20 Tag(37), Tag(198), Tag(17), Tag(127), Tag(711), Tag(555), Tag(54), Tag(32), Tag(31),
21 Tag(58), Tag(354), Tag(355),
22 ],
23 &[
24 Header::known_tags(), Trailer::known_tags(), Instrument::known_tags(),
25 UndInstrmtGrp::known_tags(), InstrmtLegGrp::known_tags(),
26 OrderQtyData::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 #[doc(alias = "OrderID")]
50 pub fn order_id(&self) -> Result<Option<&str>, InvalidValue> {
51 self.0.get_str(Tag(37))
52 }
53
54 #[doc(alias = "SecondaryOrderID")]
56 pub fn secondary_order_id(&self) -> Result<Option<&str>, InvalidValue> {
57 self.0.get_str(Tag(198))
58 }
59
60 #[doc(alias = "ExecID")]
62 pub fn exec_id(&self) -> Result<Option<&str>, InvalidValue> {
63 self.0.get_str(Tag(17))
64 }
65
66 #[doc(alias = "DKReason")]
68 pub fn dk_reason(&self) -> Result<Option<DKReason<'_>>, InvalidValue> {
69 Ok(self.0.get_str(Tag(127))?.map(DKReason::from_value))
70 }
71
72 pub fn instrument(&self) -> Instrument<'_> {
74 Instrument(self.0.scope(), Self::known_tags().get())
75 }
76
77 #[doc(alias = "NoUnderlyings")]
79 pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
80 self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
81 }
82
83 #[doc(alias = "NoLegs")]
85 pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
86 self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
87 }
88
89 #[doc(alias = "Side")]
91 pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
92 Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
93 }
94
95 pub fn order_qty_data(&self) -> OrderQtyData<'_> {
97 OrderQtyData(self.0.scope())
98 }
99
100 #[doc(alias = "LastQty")]
102 pub fn last_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
103 self.0.get_decimal(Tag(32))
104 }
105
106 #[doc(alias = "LastPx")]
108 pub fn last_px(&self) -> Result<Option<Decimal>, InvalidValue> {
109 self.0.get_decimal(Tag(31))
110 }
111
112 #[doc(alias = "Text")]
114 pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
115 self.0.get_str(Tag(58))
116 }
117
118 #[doc(alias = "EncodedTextLen")]
120 pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
121 self.0.get_int(Tag(354))
122 }
123
124 #[doc(alias = "EncodedText")]
126 pub fn encoded_text(&self) -> Option<&[u8]> {
127 self.0.get(Tag(355))
128 }
129}
130
131impl std::fmt::Debug for DontKnowTrade {
132 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
133 write!(f, "DontKnowTrade({})", self.0)
134 }
135}
136
137impl std::fmt::Display for DontKnowTrade {
138 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
139 std::fmt::Display::fmt(&self.0, f)
140 }
141}