1#![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
18pub struct SecurityList {
20 pub message: Message,
21}
22
23impl SecurityList {
24 pub fn new() -> Self {
26 let mut msg = Message::new();
27 msg.header.set_field(tag::MSG_TYPE, FIXString::from("y".to_string()));
28
29 Self { message: msg }
30 }
31
32 pub fn from_message(msg: Message) -> Self {
34 Self { message: msg }
35 }
36
37 pub fn to_message(self) -> Message {
39 self.message
40 }
41
42
43
44
45 pub fn set_appl_id(&mut self, v: String) {
47 self.message.body.set_field(tag::APPL_ID, FIXString::from(v));
48 }
49
50 pub fn get_appl_id(&self) -> Result<String, MessageRejectErrorEnum> {
52 let mut fld = field::ApplIDField::new(String::new());
53 self.message.body.get_field(tag::APPL_ID, &mut fld.0)?;
54 Ok(fld.value().to_string())
55 }
56
57
58 pub fn has_appl_id(&self) -> bool {
60 self.message.body.has(tag::APPL_ID)
61 }
62
63
64
65
66 pub fn set_appl_last_seq_num(&mut self, v: isize) {
68 self.message.body.set_field(tag::APPL_LAST_SEQ_NUM, fixer::fix_int::FIXInt::from(v));
69 }
70
71 pub fn get_appl_last_seq_num(&self) -> Result<isize, MessageRejectErrorEnum> {
73 let mut fld = field::ApplLastSeqNumField::new(0);
74 self.message.body.get_field(tag::APPL_LAST_SEQ_NUM, &mut fld.0)?;
75 Ok(fld.value())
76 }
77
78
79 pub fn has_appl_last_seq_num(&self) -> bool {
81 self.message.body.has(tag::APPL_LAST_SEQ_NUM)
82 }
83
84
85
86
87 pub fn set_appl_resend_flag(&mut self, v: bool) {
89 self.message.body.set_field(tag::APPL_RESEND_FLAG, fixer::fix_boolean::FIXBoolean::from(v));
90 }
91
92 pub fn get_appl_resend_flag(&self) -> Result<bool, MessageRejectErrorEnum> {
94 let mut fld = field::ApplResendFlagField::new(false);
95 self.message.body.get_field(tag::APPL_RESEND_FLAG, &mut fld.0)?;
96 Ok(fld.value())
97 }
98
99
100 pub fn has_appl_resend_flag(&self) -> bool {
102 self.message.body.has(tag::APPL_RESEND_FLAG)
103 }
104
105
106
107
108 pub fn set_appl_seq_num(&mut self, v: isize) {
110 self.message.body.set_field(tag::APPL_SEQ_NUM, fixer::fix_int::FIXInt::from(v));
111 }
112
113 pub fn get_appl_seq_num(&self) -> Result<isize, MessageRejectErrorEnum> {
115 let mut fld = field::ApplSeqNumField::new(0);
116 self.message.body.get_field(tag::APPL_SEQ_NUM, &mut fld.0)?;
117 Ok(fld.value())
118 }
119
120
121 pub fn has_appl_seq_num(&self) -> bool {
123 self.message.body.has(tag::APPL_SEQ_NUM)
124 }
125
126
127
128
129 pub fn set_clearing_business_date(&mut self, v: String) {
131 self.message.body.set_field(tag::CLEARING_BUSINESS_DATE, FIXString::from(v));
132 }
133
134 pub fn get_clearing_business_date(&self) -> Result<String, MessageRejectErrorEnum> {
136 let mut fld = field::ClearingBusinessDateField::new(String::new());
137 self.message.body.get_field(tag::CLEARING_BUSINESS_DATE, &mut fld.0)?;
138 Ok(fld.value().to_string())
139 }
140
141
142 pub fn has_clearing_business_date(&self) -> bool {
144 self.message.body.has(tag::CLEARING_BUSINESS_DATE)
145 }
146
147
148
149
150 pub fn set_encoded_security_list_desc(&mut self, v: String) {
152 self.message.body.set_field(tag::ENCODED_SECURITY_LIST_DESC, FIXString::from(v));
153 }
154
155 pub fn get_encoded_security_list_desc(&self) -> Result<String, MessageRejectErrorEnum> {
157 let mut fld = field::EncodedSecurityListDescField::new(String::new());
158 self.message.body.get_field(tag::ENCODED_SECURITY_LIST_DESC, &mut fld.0)?;
159 Ok(fld.value().to_string())
160 }
161
162
163 pub fn has_encoded_security_list_desc(&self) -> bool {
165 self.message.body.has(tag::ENCODED_SECURITY_LIST_DESC)
166 }
167
168
169
170
171 pub fn set_encoded_security_list_desc_len(&mut self, v: isize) {
173 self.message.body.set_field(tag::ENCODED_SECURITY_LIST_DESC_LEN, fixer::fix_int::FIXInt::from(v));
174 }
175
176 pub fn get_encoded_security_list_desc_len(&self) -> Result<isize, MessageRejectErrorEnum> {
178 let mut fld = field::EncodedSecurityListDescLenField::new(0);
179 self.message.body.get_field(tag::ENCODED_SECURITY_LIST_DESC_LEN, &mut fld.0)?;
180 Ok(fld.value())
181 }
182
183
184 pub fn has_encoded_security_list_desc_len(&self) -> bool {
186 self.message.body.has(tag::ENCODED_SECURITY_LIST_DESC_LEN)
187 }
188
189
190
191
192 pub fn set_last_fragment(&mut self, v: bool) {
194 self.message.body.set_field(tag::LAST_FRAGMENT, fixer::fix_boolean::FIXBoolean::from(v));
195 }
196
197 pub fn get_last_fragment(&self) -> Result<bool, MessageRejectErrorEnum> {
199 let mut fld = field::LastFragmentField::new(false);
200 self.message.body.get_field(tag::LAST_FRAGMENT, &mut fld.0)?;
201 Ok(fld.value())
202 }
203
204
205 pub fn has_last_fragment(&self) -> bool {
207 self.message.body.has(tag::LAST_FRAGMENT)
208 }
209
210
211
212
213 pub fn set_market_id(&mut self, v: String) {
215 self.message.body.set_field(tag::MARKET_ID, FIXString::from(v));
216 }
217
218 pub fn get_market_id(&self) -> Result<String, MessageRejectErrorEnum> {
220 let mut fld = field::MarketIDField::new(String::new());
221 self.message.body.get_field(tag::MARKET_ID, &mut fld.0)?;
222 Ok(fld.value().to_string())
223 }
224
225
226 pub fn has_market_id(&self) -> bool {
228 self.message.body.has(tag::MARKET_ID)
229 }
230
231
232
233
234 pub fn set_market_segment_id(&mut self, v: String) {
236 self.message.body.set_field(tag::MARKET_SEGMENT_ID, FIXString::from(v));
237 }
238
239 pub fn get_market_segment_id(&self) -> Result<String, MessageRejectErrorEnum> {
241 let mut fld = field::MarketSegmentIDField::new(String::new());
242 self.message.body.get_field(tag::MARKET_SEGMENT_ID, &mut fld.0)?;
243 Ok(fld.value().to_string())
244 }
245
246
247 pub fn has_market_segment_id(&self) -> bool {
249 self.message.body.has(tag::MARKET_SEGMENT_ID)
250 }
251
252
253
254
255 pub fn set_no_related_sym(&mut self, v: isize) {
257 self.message.body.set_field(tag::NO_RELATED_SYM, fixer::fix_int::FIXInt::from(v));
258 }
259
260 pub fn get_no_related_sym(&self) -> Result<isize, MessageRejectErrorEnum> {
262 let mut fld = field::NoRelatedSymField::new(0);
263 self.message.body.get_field(tag::NO_RELATED_SYM, &mut fld.0)?;
264 Ok(fld.value())
265 }
266
267
268 pub fn has_no_related_sym(&self) -> bool {
270 self.message.body.has(tag::NO_RELATED_SYM)
271 }
272
273
274
275
276 pub fn set_security_list_desc(&mut self, v: String) {
278 self.message.body.set_field(tag::SECURITY_LIST_DESC, FIXString::from(v));
279 }
280
281 pub fn get_security_list_desc(&self) -> Result<String, MessageRejectErrorEnum> {
283 let mut fld = field::SecurityListDescField::new(String::new());
284 self.message.body.get_field(tag::SECURITY_LIST_DESC, &mut fld.0)?;
285 Ok(fld.value().to_string())
286 }
287
288
289 pub fn has_security_list_desc(&self) -> bool {
291 self.message.body.has(tag::SECURITY_LIST_DESC)
292 }
293
294
295
296
297 pub fn set_security_list_id(&mut self, v: String) {
299 self.message.body.set_field(tag::SECURITY_LIST_ID, FIXString::from(v));
300 }
301
302 pub fn get_security_list_id(&self) -> Result<String, MessageRejectErrorEnum> {
304 let mut fld = field::SecurityListIDField::new(String::new());
305 self.message.body.get_field(tag::SECURITY_LIST_ID, &mut fld.0)?;
306 Ok(fld.value().to_string())
307 }
308
309
310 pub fn has_security_list_id(&self) -> bool {
312 self.message.body.has(tag::SECURITY_LIST_ID)
313 }
314
315
316
317
318 pub fn set_security_list_ref_id(&mut self, v: String) {
320 self.message.body.set_field(tag::SECURITY_LIST_REF_ID, FIXString::from(v));
321 }
322
323 pub fn get_security_list_ref_id(&self) -> Result<String, MessageRejectErrorEnum> {
325 let mut fld = field::SecurityListRefIDField::new(String::new());
326 self.message.body.get_field(tag::SECURITY_LIST_REF_ID, &mut fld.0)?;
327 Ok(fld.value().to_string())
328 }
329
330
331 pub fn has_security_list_ref_id(&self) -> bool {
333 self.message.body.has(tag::SECURITY_LIST_REF_ID)
334 }
335
336
337
338
339 pub fn set_security_list_type(&mut self, v: isize) {
341 self.message.body.set_field(tag::SECURITY_LIST_TYPE, fixer::fix_int::FIXInt::from(v));
342 }
343
344 pub fn get_security_list_type(&self) -> Result<isize, MessageRejectErrorEnum> {
346 let mut fld = field::SecurityListTypeField::new(0);
347 self.message.body.get_field(tag::SECURITY_LIST_TYPE, &mut fld.0)?;
348 Ok(fld.value())
349 }
350
351
352 pub fn has_security_list_type(&self) -> bool {
354 self.message.body.has(tag::SECURITY_LIST_TYPE)
355 }
356
357
358
359
360 pub fn set_security_list_type_source(&mut self, v: isize) {
362 self.message.body.set_field(tag::SECURITY_LIST_TYPE_SOURCE, fixer::fix_int::FIXInt::from(v));
363 }
364
365 pub fn get_security_list_type_source(&self) -> Result<isize, MessageRejectErrorEnum> {
367 let mut fld = field::SecurityListTypeSourceField::new(0);
368 self.message.body.get_field(tag::SECURITY_LIST_TYPE_SOURCE, &mut fld.0)?;
369 Ok(fld.value())
370 }
371
372
373 pub fn has_security_list_type_source(&self) -> bool {
375 self.message.body.has(tag::SECURITY_LIST_TYPE_SOURCE)
376 }
377
378
379
380
381 pub fn set_security_report_id(&mut self, v: isize) {
383 self.message.body.set_field(tag::SECURITY_REPORT_ID, fixer::fix_int::FIXInt::from(v));
384 }
385
386 pub fn get_security_report_id(&self) -> Result<isize, MessageRejectErrorEnum> {
388 let mut fld = field::SecurityReportIDField::new(0);
389 self.message.body.get_field(tag::SECURITY_REPORT_ID, &mut fld.0)?;
390 Ok(fld.value())
391 }
392
393
394 pub fn has_security_report_id(&self) -> bool {
396 self.message.body.has(tag::SECURITY_REPORT_ID)
397 }
398
399
400
401
402 pub fn set_security_req_id(&mut self, v: String) {
404 self.message.body.set_field(tag::SECURITY_REQ_ID, FIXString::from(v));
405 }
406
407 pub fn get_security_req_id(&self) -> Result<String, MessageRejectErrorEnum> {
409 let mut fld = field::SecurityReqIDField::new(String::new());
410 self.message.body.get_field(tag::SECURITY_REQ_ID, &mut fld.0)?;
411 Ok(fld.value().to_string())
412 }
413
414
415 pub fn has_security_req_id(&self) -> bool {
417 self.message.body.has(tag::SECURITY_REQ_ID)
418 }
419
420
421
422
423 pub fn set_security_request_result(&mut self, v: isize) {
425 self.message.body.set_field(tag::SECURITY_REQUEST_RESULT, fixer::fix_int::FIXInt::from(v));
426 }
427
428 pub fn get_security_request_result(&self) -> Result<isize, MessageRejectErrorEnum> {
430 let mut fld = field::SecurityRequestResultField::new(0);
431 self.message.body.get_field(tag::SECURITY_REQUEST_RESULT, &mut fld.0)?;
432 Ok(fld.value())
433 }
434
435
436 pub fn has_security_request_result(&self) -> bool {
438 self.message.body.has(tag::SECURITY_REQUEST_RESULT)
439 }
440
441
442
443
444 pub fn set_security_response_id(&mut self, v: String) {
446 self.message.body.set_field(tag::SECURITY_RESPONSE_ID, FIXString::from(v));
447 }
448
449 pub fn get_security_response_id(&self) -> Result<String, MessageRejectErrorEnum> {
451 let mut fld = field::SecurityResponseIDField::new(String::new());
452 self.message.body.get_field(tag::SECURITY_RESPONSE_ID, &mut fld.0)?;
453 Ok(fld.value().to_string())
454 }
455
456
457 pub fn has_security_response_id(&self) -> bool {
459 self.message.body.has(tag::SECURITY_RESPONSE_ID)
460 }
461
462
463
464
465 pub fn set_tot_no_related_sym(&mut self, v: isize) {
467 self.message.body.set_field(tag::TOT_NO_RELATED_SYM, fixer::fix_int::FIXInt::from(v));
468 }
469
470 pub fn get_tot_no_related_sym(&self) -> Result<isize, MessageRejectErrorEnum> {
472 let mut fld = field::TotNoRelatedSymField::new(0);
473 self.message.body.get_field(tag::TOT_NO_RELATED_SYM, &mut fld.0)?;
474 Ok(fld.value())
475 }
476
477
478 pub fn has_tot_no_related_sym(&self) -> bool {
480 self.message.body.has(tag::TOT_NO_RELATED_SYM)
481 }
482
483
484
485
486 pub fn set_transact_time(&mut self, v: Timestamp) {
488 self.message.body.set_field(tag::TRANSACT_TIME, fixer::fix_utc_timestamp::FIXUTCTimestamp {
489 time: v,
490 precision: fixer::fix_utc_timestamp::TimestampPrecision::Millis,
491 });
492 }
493
494 pub fn get_transact_time(&self) -> Result<Timestamp, MessageRejectErrorEnum> {
496 let mut fld = field::TransactTimeField::new(Timestamp::UNIX_EPOCH);
497 self.message.body.get_field(tag::TRANSACT_TIME, &mut fld.0)?;
498 Ok(fld.value())
499 }
500
501
502 pub fn has_transact_time(&self) -> bool {
504 self.message.body.has(tag::TRANSACT_TIME)
505 }
506
507
508}
509
510pub type RouteOut = fn(msg: SecurityList, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
512
513pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
515
516pub fn route(router: RouteOut) -> Route {
518 let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
519 router(SecurityList::from_message(msg.clone()), session_id)
520 };
521 ("9", "y", Box::new(r))
522}