Skip to main content

fixer_fix/fix42/
list_status.rs

1// Code generated by fixer-gen. DO NOT EDIT.
2#![allow(clippy::new_without_default)]
3#![allow(clippy::needless_pass_by_value)]
4#![allow(clippy::too_many_arguments)]
5#![allow(unused_imports)]
6
7use fixer::message::Message;
8use fixer::fix_string::FIXString;
9use fixer::errors::MessageRejectErrorEnum;
10use fixer::session::session_id::SessionID;
11
12
13use jiff::Timestamp;
14
15use crate::field;
16use crate::tag;
17
18/// `ListStatus` is the `fix42` `ListStatus` type, `MsgType` = N.
19pub struct ListStatus {
20    pub message: Message,
21}
22
23impl ListStatus {
24    /// Creates a new `ListStatus` with required fields.
25    pub fn new(list_id: field::ListIDField, list_status_type: field::ListStatusTypeField, no_rpts: field::NoRptsField, list_order_status: field::ListOrderStatusField, rpt_seq: field::RptSeqField, tot_no_orders: field::TotNoOrdersField, no_orders: field::NoOrdersField) -> Self {
26        let mut msg = Message::new();
27        msg.header.set_field(tag::MSG_TYPE, FIXString::from("N".to_string()));
28
29        msg.body.set_field(tag::LIST_ID, list_id.0);
30
31        msg.body.set_field(tag::LIST_STATUS_TYPE, list_status_type.0);
32
33        msg.body.set_field(tag::NO_RPTS, no_rpts.0);
34
35        msg.body.set_field(tag::LIST_ORDER_STATUS, list_order_status.0);
36
37        msg.body.set_field(tag::RPT_SEQ, rpt_seq.0);
38
39        msg.body.set_field(tag::TOT_NO_ORDERS, tot_no_orders.0);
40
41        msg.body.set_field(tag::NO_ORDERS, no_orders.0);
42
43        Self { message: msg }
44    }
45
46    /// Creates a `ListStatus` from an existing `Message`.
47    pub fn from_message(msg: Message) -> Self {
48        Self { message: msg }
49    }
50
51    /// Returns the underlying `Message`.
52    pub fn to_message(self) -> Message {
53        self.message
54    }
55
56
57
58
59    /// Sets `EncodedListStatusText`, Tag 446.
60    pub fn set_encoded_list_status_text(&mut self, v: String) {
61        self.message.body.set_field(tag::ENCODED_LIST_STATUS_TEXT, FIXString::from(v));
62    }
63
64    /// Gets `EncodedListStatusText`, Tag 446.
65    pub fn get_encoded_list_status_text(&self) -> Result<String, MessageRejectErrorEnum> {
66        let mut fld = field::EncodedListStatusTextField::new(String::new());
67        self.message.body.get_field(tag::ENCODED_LIST_STATUS_TEXT, &mut fld.0)?;
68        Ok(fld.value().to_string())
69    }
70
71
72    /// Returns true if `EncodedListStatusText` is present, Tag 446.
73    pub fn has_encoded_list_status_text(&self) -> bool {
74        self.message.body.has(tag::ENCODED_LIST_STATUS_TEXT)
75    }
76
77
78
79
80    /// Sets `EncodedListStatusTextLen`, Tag 445.
81    pub fn set_encoded_list_status_text_len(&mut self, v: isize) {
82        self.message.body.set_field(tag::ENCODED_LIST_STATUS_TEXT_LEN, fixer::fix_int::FIXInt::from(v));
83    }
84
85    /// Gets `EncodedListStatusTextLen`, Tag 445.
86    pub fn get_encoded_list_status_text_len(&self) -> Result<isize, MessageRejectErrorEnum> {
87        let mut fld = field::EncodedListStatusTextLenField::new(0);
88        self.message.body.get_field(tag::ENCODED_LIST_STATUS_TEXT_LEN, &mut fld.0)?;
89        Ok(fld.value())
90    }
91
92
93    /// Returns true if `EncodedListStatusTextLen` is present, Tag 445.
94    pub fn has_encoded_list_status_text_len(&self) -> bool {
95        self.message.body.has(tag::ENCODED_LIST_STATUS_TEXT_LEN)
96    }
97
98
99
100
101    /// Sets `ListID`, Tag 66.
102    pub fn set_list_id(&mut self, v: String) {
103        self.message.body.set_field(tag::LIST_ID, FIXString::from(v));
104    }
105
106    /// Gets `ListID`, Tag 66.
107    pub fn get_list_id(&self) -> Result<String, MessageRejectErrorEnum> {
108        let mut fld = field::ListIDField::new(String::new());
109        self.message.body.get_field(tag::LIST_ID, &mut fld.0)?;
110        Ok(fld.value().to_string())
111    }
112
113
114    /// Returns true if `ListID` is present, Tag 66.
115    pub fn has_list_id(&self) -> bool {
116        self.message.body.has(tag::LIST_ID)
117    }
118
119
120
121
122    /// Sets `ListOrderStatus`, Tag 431.
123    pub fn set_list_order_status(&mut self, v: isize) {
124        self.message.body.set_field(tag::LIST_ORDER_STATUS, fixer::fix_int::FIXInt::from(v));
125    }
126
127    /// Gets `ListOrderStatus`, Tag 431.
128    pub fn get_list_order_status(&self) -> Result<isize, MessageRejectErrorEnum> {
129        let mut fld = field::ListOrderStatusField::new(0);
130        self.message.body.get_field(tag::LIST_ORDER_STATUS, &mut fld.0)?;
131        Ok(fld.value())
132    }
133
134
135    /// Returns true if `ListOrderStatus` is present, Tag 431.
136    pub fn has_list_order_status(&self) -> bool {
137        self.message.body.has(tag::LIST_ORDER_STATUS)
138    }
139
140
141
142
143    /// Sets `ListStatusText`, Tag 444.
144    pub fn set_list_status_text(&mut self, v: String) {
145        self.message.body.set_field(tag::LIST_STATUS_TEXT, FIXString::from(v));
146    }
147
148    /// Gets `ListStatusText`, Tag 444.
149    pub fn get_list_status_text(&self) -> Result<String, MessageRejectErrorEnum> {
150        let mut fld = field::ListStatusTextField::new(String::new());
151        self.message.body.get_field(tag::LIST_STATUS_TEXT, &mut fld.0)?;
152        Ok(fld.value().to_string())
153    }
154
155
156    /// Returns true if `ListStatusText` is present, Tag 444.
157    pub fn has_list_status_text(&self) -> bool {
158        self.message.body.has(tag::LIST_STATUS_TEXT)
159    }
160
161
162
163
164    /// Sets `ListStatusType`, Tag 429.
165    pub fn set_list_status_type(&mut self, v: isize) {
166        self.message.body.set_field(tag::LIST_STATUS_TYPE, fixer::fix_int::FIXInt::from(v));
167    }
168
169    /// Gets `ListStatusType`, Tag 429.
170    pub fn get_list_status_type(&self) -> Result<isize, MessageRejectErrorEnum> {
171        let mut fld = field::ListStatusTypeField::new(0);
172        self.message.body.get_field(tag::LIST_STATUS_TYPE, &mut fld.0)?;
173        Ok(fld.value())
174    }
175
176
177    /// Returns true if `ListStatusType` is present, Tag 429.
178    pub fn has_list_status_type(&self) -> bool {
179        self.message.body.has(tag::LIST_STATUS_TYPE)
180    }
181
182
183
184
185    /// Sets `NoOrders`, Tag 73.
186    pub fn set_no_orders(&mut self, v: isize) {
187        self.message.body.set_field(tag::NO_ORDERS, fixer::fix_int::FIXInt::from(v));
188    }
189
190    /// Gets `NoOrders`, Tag 73.
191    pub fn get_no_orders(&self) -> Result<isize, MessageRejectErrorEnum> {
192        let mut fld = field::NoOrdersField::new(0);
193        self.message.body.get_field(tag::NO_ORDERS, &mut fld.0)?;
194        Ok(fld.value())
195    }
196
197
198    /// Returns true if `NoOrders` is present, Tag 73.
199    pub fn has_no_orders(&self) -> bool {
200        self.message.body.has(tag::NO_ORDERS)
201    }
202
203
204
205
206    /// Sets `NoRpts`, Tag 82.
207    pub fn set_no_rpts(&mut self, v: isize) {
208        self.message.body.set_field(tag::NO_RPTS, fixer::fix_int::FIXInt::from(v));
209    }
210
211    /// Gets `NoRpts`, Tag 82.
212    pub fn get_no_rpts(&self) -> Result<isize, MessageRejectErrorEnum> {
213        let mut fld = field::NoRptsField::new(0);
214        self.message.body.get_field(tag::NO_RPTS, &mut fld.0)?;
215        Ok(fld.value())
216    }
217
218
219    /// Returns true if `NoRpts` is present, Tag 82.
220    pub fn has_no_rpts(&self) -> bool {
221        self.message.body.has(tag::NO_RPTS)
222    }
223
224
225
226
227    /// Sets `RptSeq`, Tag 83.
228    pub fn set_rpt_seq(&mut self, v: isize) {
229        self.message.body.set_field(tag::RPT_SEQ, fixer::fix_int::FIXInt::from(v));
230    }
231
232    /// Gets `RptSeq`, Tag 83.
233    pub fn get_rpt_seq(&self) -> Result<isize, MessageRejectErrorEnum> {
234        let mut fld = field::RptSeqField::new(0);
235        self.message.body.get_field(tag::RPT_SEQ, &mut fld.0)?;
236        Ok(fld.value())
237    }
238
239
240    /// Returns true if `RptSeq` is present, Tag 83.
241    pub fn has_rpt_seq(&self) -> bool {
242        self.message.body.has(tag::RPT_SEQ)
243    }
244
245
246
247
248    /// Sets `TotNoOrders`, Tag 68.
249    pub fn set_tot_no_orders(&mut self, v: isize) {
250        self.message.body.set_field(tag::TOT_NO_ORDERS, fixer::fix_int::FIXInt::from(v));
251    }
252
253    /// Gets `TotNoOrders`, Tag 68.
254    pub fn get_tot_no_orders(&self) -> Result<isize, MessageRejectErrorEnum> {
255        let mut fld = field::TotNoOrdersField::new(0);
256        self.message.body.get_field(tag::TOT_NO_ORDERS, &mut fld.0)?;
257        Ok(fld.value())
258    }
259
260
261    /// Returns true if `TotNoOrders` is present, Tag 68.
262    pub fn has_tot_no_orders(&self) -> bool {
263        self.message.body.has(tag::TOT_NO_ORDERS)
264    }
265
266
267
268
269    /// Sets `TransactTime`, Tag 60.
270    pub fn set_transact_time(&mut self, v: Timestamp) {
271        self.message.body.set_field(tag::TRANSACT_TIME, fixer::fix_utc_timestamp::FIXUTCTimestamp {
272            time: v,
273            precision: fixer::fix_utc_timestamp::TimestampPrecision::Millis,
274        });
275    }
276
277    /// Gets `TransactTime`, Tag 60.
278    pub fn get_transact_time(&self) -> Result<Timestamp, MessageRejectErrorEnum> {
279        let mut fld = field::TransactTimeField::new(Timestamp::UNIX_EPOCH);
280        self.message.body.get_field(tag::TRANSACT_TIME, &mut fld.0)?;
281        Ok(fld.value())
282    }
283
284
285    /// Returns true if `TransactTime` is present, Tag 60.
286    pub fn has_transact_time(&self) -> bool {
287        self.message.body.has(tag::TRANSACT_TIME)
288    }
289
290
291}
292
293/// `RouteOut` is the callback type for routing `ListStatus` messages.
294pub type RouteOut = fn(msg: ListStatus, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
295
296/// Route type returned by the `route` function.
297pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
298
299/// Returns the begin string, message type, and route function for `ListStatus`.
300pub fn route(router: RouteOut) -> Route {
301    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
302        router(ListStatus::from_message(msg.clone()), session_id)
303    };
304    ("FIX.4.2", "N", Box::new(r))
305}