Skip to main content

fixer_fix/fix50sp2/
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 `fix50sp2` `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 `ContingencyType`, Tag 1385.
60    pub fn set_contingency_type(&mut self, v: isize) {
61        self.message.body.set_field(tag::CONTINGENCY_TYPE, fixer::fix_int::FIXInt::from(v));
62    }
63
64    /// Gets `ContingencyType`, Tag 1385.
65    pub fn get_contingency_type(&self) -> Result<isize, MessageRejectErrorEnum> {
66        let mut fld = field::ContingencyTypeField::new(0);
67        self.message.body.get_field(tag::CONTINGENCY_TYPE, &mut fld.0)?;
68        Ok(fld.value())
69    }
70
71
72    /// Returns true if `ContingencyType` is present, Tag 1385.
73    pub fn has_contingency_type(&self) -> bool {
74        self.message.body.has(tag::CONTINGENCY_TYPE)
75    }
76
77
78
79
80    /// Sets `EncodedListStatusText`, Tag 446.
81    pub fn set_encoded_list_status_text(&mut self, v: String) {
82        self.message.body.set_field(tag::ENCODED_LIST_STATUS_TEXT, FIXString::from(v));
83    }
84
85    /// Gets `EncodedListStatusText`, Tag 446.
86    pub fn get_encoded_list_status_text(&self) -> Result<String, MessageRejectErrorEnum> {
87        let mut fld = field::EncodedListStatusTextField::new(String::new());
88        self.message.body.get_field(tag::ENCODED_LIST_STATUS_TEXT, &mut fld.0)?;
89        Ok(fld.value().to_string())
90    }
91
92
93    /// Returns true if `EncodedListStatusText` is present, Tag 446.
94    pub fn has_encoded_list_status_text(&self) -> bool {
95        self.message.body.has(tag::ENCODED_LIST_STATUS_TEXT)
96    }
97
98
99
100
101    /// Sets `EncodedListStatusTextLen`, Tag 445.
102    pub fn set_encoded_list_status_text_len(&mut self, v: isize) {
103        self.message.body.set_field(tag::ENCODED_LIST_STATUS_TEXT_LEN, fixer::fix_int::FIXInt::from(v));
104    }
105
106    /// Gets `EncodedListStatusTextLen`, Tag 445.
107    pub fn get_encoded_list_status_text_len(&self) -> Result<isize, MessageRejectErrorEnum> {
108        let mut fld = field::EncodedListStatusTextLenField::new(0);
109        self.message.body.get_field(tag::ENCODED_LIST_STATUS_TEXT_LEN, &mut fld.0)?;
110        Ok(fld.value())
111    }
112
113
114    /// Returns true if `EncodedListStatusTextLen` is present, Tag 445.
115    pub fn has_encoded_list_status_text_len(&self) -> bool {
116        self.message.body.has(tag::ENCODED_LIST_STATUS_TEXT_LEN)
117    }
118
119
120
121
122    /// Sets `LastFragment`, Tag 893.
123    pub fn set_last_fragment(&mut self, v: bool) {
124        self.message.body.set_field(tag::LAST_FRAGMENT, fixer::fix_boolean::FIXBoolean::from(v));
125    }
126
127    /// Gets `LastFragment`, Tag 893.
128    pub fn get_last_fragment(&self) -> Result<bool, MessageRejectErrorEnum> {
129        let mut fld = field::LastFragmentField::new(false);
130        self.message.body.get_field(tag::LAST_FRAGMENT, &mut fld.0)?;
131        Ok(fld.value())
132    }
133
134
135    /// Returns true if `LastFragment` is present, Tag 893.
136    pub fn has_last_fragment(&self) -> bool {
137        self.message.body.has(tag::LAST_FRAGMENT)
138    }
139
140
141
142
143    /// Sets `ListID`, Tag 66.
144    pub fn set_list_id(&mut self, v: String) {
145        self.message.body.set_field(tag::LIST_ID, FIXString::from(v));
146    }
147
148    /// Gets `ListID`, Tag 66.
149    pub fn get_list_id(&self) -> Result<String, MessageRejectErrorEnum> {
150        let mut fld = field::ListIDField::new(String::new());
151        self.message.body.get_field(tag::LIST_ID, &mut fld.0)?;
152        Ok(fld.value().to_string())
153    }
154
155
156    /// Returns true if `ListID` is present, Tag 66.
157    pub fn has_list_id(&self) -> bool {
158        self.message.body.has(tag::LIST_ID)
159    }
160
161
162
163
164    /// Sets `ListOrderStatus`, Tag 431.
165    pub fn set_list_order_status(&mut self, v: isize) {
166        self.message.body.set_field(tag::LIST_ORDER_STATUS, fixer::fix_int::FIXInt::from(v));
167    }
168
169    /// Gets `ListOrderStatus`, Tag 431.
170    pub fn get_list_order_status(&self) -> Result<isize, MessageRejectErrorEnum> {
171        let mut fld = field::ListOrderStatusField::new(0);
172        self.message.body.get_field(tag::LIST_ORDER_STATUS, &mut fld.0)?;
173        Ok(fld.value())
174    }
175
176
177    /// Returns true if `ListOrderStatus` is present, Tag 431.
178    pub fn has_list_order_status(&self) -> bool {
179        self.message.body.has(tag::LIST_ORDER_STATUS)
180    }
181
182
183
184
185    /// Sets `ListRejectReason`, Tag 1386.
186    pub fn set_list_reject_reason(&mut self, v: isize) {
187        self.message.body.set_field(tag::LIST_REJECT_REASON, fixer::fix_int::FIXInt::from(v));
188    }
189
190    /// Gets `ListRejectReason`, Tag 1386.
191    pub fn get_list_reject_reason(&self) -> Result<isize, MessageRejectErrorEnum> {
192        let mut fld = field::ListRejectReasonField::new(0);
193        self.message.body.get_field(tag::LIST_REJECT_REASON, &mut fld.0)?;
194        Ok(fld.value())
195    }
196
197
198    /// Returns true if `ListRejectReason` is present, Tag 1386.
199    pub fn has_list_reject_reason(&self) -> bool {
200        self.message.body.has(tag::LIST_REJECT_REASON)
201    }
202
203
204
205
206    /// Sets `ListStatusText`, Tag 444.
207    pub fn set_list_status_text(&mut self, v: String) {
208        self.message.body.set_field(tag::LIST_STATUS_TEXT, FIXString::from(v));
209    }
210
211    /// Gets `ListStatusText`, Tag 444.
212    pub fn get_list_status_text(&self) -> Result<String, MessageRejectErrorEnum> {
213        let mut fld = field::ListStatusTextField::new(String::new());
214        self.message.body.get_field(tag::LIST_STATUS_TEXT, &mut fld.0)?;
215        Ok(fld.value().to_string())
216    }
217
218
219    /// Returns true if `ListStatusText` is present, Tag 444.
220    pub fn has_list_status_text(&self) -> bool {
221        self.message.body.has(tag::LIST_STATUS_TEXT)
222    }
223
224
225
226
227    /// Sets `ListStatusType`, Tag 429.
228    pub fn set_list_status_type(&mut self, v: isize) {
229        self.message.body.set_field(tag::LIST_STATUS_TYPE, fixer::fix_int::FIXInt::from(v));
230    }
231
232    /// Gets `ListStatusType`, Tag 429.
233    pub fn get_list_status_type(&self) -> Result<isize, MessageRejectErrorEnum> {
234        let mut fld = field::ListStatusTypeField::new(0);
235        self.message.body.get_field(tag::LIST_STATUS_TYPE, &mut fld.0)?;
236        Ok(fld.value())
237    }
238
239
240    /// Returns true if `ListStatusType` is present, Tag 429.
241    pub fn has_list_status_type(&self) -> bool {
242        self.message.body.has(tag::LIST_STATUS_TYPE)
243    }
244
245
246
247
248    /// Sets `NoOrders`, Tag 73.
249    pub fn set_no_orders(&mut self, v: isize) {
250        self.message.body.set_field(tag::NO_ORDERS, fixer::fix_int::FIXInt::from(v));
251    }
252
253    /// Gets `NoOrders`, Tag 73.
254    pub fn get_no_orders(&self) -> Result<isize, MessageRejectErrorEnum> {
255        let mut fld = field::NoOrdersField::new(0);
256        self.message.body.get_field(tag::NO_ORDERS, &mut fld.0)?;
257        Ok(fld.value())
258    }
259
260
261    /// Returns true if `NoOrders` is present, Tag 73.
262    pub fn has_no_orders(&self) -> bool {
263        self.message.body.has(tag::NO_ORDERS)
264    }
265
266
267
268
269    /// Sets `NoRpts`, Tag 82.
270    pub fn set_no_rpts(&mut self, v: isize) {
271        self.message.body.set_field(tag::NO_RPTS, fixer::fix_int::FIXInt::from(v));
272    }
273
274    /// Gets `NoRpts`, Tag 82.
275    pub fn get_no_rpts(&self) -> Result<isize, MessageRejectErrorEnum> {
276        let mut fld = field::NoRptsField::new(0);
277        self.message.body.get_field(tag::NO_RPTS, &mut fld.0)?;
278        Ok(fld.value())
279    }
280
281
282    /// Returns true if `NoRpts` is present, Tag 82.
283    pub fn has_no_rpts(&self) -> bool {
284        self.message.body.has(tag::NO_RPTS)
285    }
286
287
288
289
290    /// Sets `RptSeq`, Tag 83.
291    pub fn set_rpt_seq(&mut self, v: isize) {
292        self.message.body.set_field(tag::RPT_SEQ, fixer::fix_int::FIXInt::from(v));
293    }
294
295    /// Gets `RptSeq`, Tag 83.
296    pub fn get_rpt_seq(&self) -> Result<isize, MessageRejectErrorEnum> {
297        let mut fld = field::RptSeqField::new(0);
298        self.message.body.get_field(tag::RPT_SEQ, &mut fld.0)?;
299        Ok(fld.value())
300    }
301
302
303    /// Returns true if `RptSeq` is present, Tag 83.
304    pub fn has_rpt_seq(&self) -> bool {
305        self.message.body.has(tag::RPT_SEQ)
306    }
307
308
309
310
311    /// Sets `TotNoOrders`, Tag 68.
312    pub fn set_tot_no_orders(&mut self, v: isize) {
313        self.message.body.set_field(tag::TOT_NO_ORDERS, fixer::fix_int::FIXInt::from(v));
314    }
315
316    /// Gets `TotNoOrders`, Tag 68.
317    pub fn get_tot_no_orders(&self) -> Result<isize, MessageRejectErrorEnum> {
318        let mut fld = field::TotNoOrdersField::new(0);
319        self.message.body.get_field(tag::TOT_NO_ORDERS, &mut fld.0)?;
320        Ok(fld.value())
321    }
322
323
324    /// Returns true if `TotNoOrders` is present, Tag 68.
325    pub fn has_tot_no_orders(&self) -> bool {
326        self.message.body.has(tag::TOT_NO_ORDERS)
327    }
328
329
330
331
332    /// Sets `TransactTime`, Tag 60.
333    pub fn set_transact_time(&mut self, v: Timestamp) {
334        self.message.body.set_field(tag::TRANSACT_TIME, fixer::fix_utc_timestamp::FIXUTCTimestamp {
335            time: v,
336            precision: fixer::fix_utc_timestamp::TimestampPrecision::Millis,
337        });
338    }
339
340    /// Gets `TransactTime`, Tag 60.
341    pub fn get_transact_time(&self) -> Result<Timestamp, MessageRejectErrorEnum> {
342        let mut fld = field::TransactTimeField::new(Timestamp::UNIX_EPOCH);
343        self.message.body.get_field(tag::TRANSACT_TIME, &mut fld.0)?;
344        Ok(fld.value())
345    }
346
347
348    /// Returns true if `TransactTime` is present, Tag 60.
349    pub fn has_transact_time(&self) -> bool {
350        self.message.body.has(tag::TRANSACT_TIME)
351    }
352
353
354}
355
356/// `RouteOut` is the callback type for routing `ListStatus` messages.
357pub type RouteOut = fn(msg: ListStatus, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
358
359/// Route type returned by the `route` function.
360pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
361
362/// Returns the begin string, message type, and route function for `ListStatus`.
363pub fn route(router: RouteOut) -> Route {
364    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
365        router(ListStatus::from_message(msg.clone()), session_id)
366    };
367    ("9", "N", Box::new(r))
368}