Skip to main content

fixer_fix/fix50sp2/
allocation_report_ack.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
12use rust_decimal::Decimal;
13
14
15use jiff::Timestamp;
16
17use crate::field;
18use crate::tag;
19
20/// `AllocationReportAck` is the `fix50sp2` `AllocationReportAck` type, `MsgType` = AT.
21pub struct AllocationReportAck {
22    pub message: Message,
23}
24
25impl AllocationReportAck {
26    /// Creates a new `AllocationReportAck` with required fields.
27    pub fn new(alloc_report_id: field::AllocReportIDField) -> Self {
28        let mut msg = Message::new();
29        msg.header.set_field(tag::MSG_TYPE, FIXString::from("AT".to_string()));
30
31        msg.body.set_field(tag::ALLOC_REPORT_ID, alloc_report_id.0);
32
33        Self { message: msg }
34    }
35
36    /// Creates a `AllocationReportAck` from an existing `Message`.
37    pub fn from_message(msg: Message) -> Self {
38        Self { message: msg }
39    }
40
41    /// Returns the underlying `Message`.
42    pub fn to_message(self) -> Message {
43        self.message
44    }
45
46
47
48
49    /// Sets `AllocID`, Tag 70.
50    pub fn set_alloc_id(&mut self, v: String) {
51        self.message.body.set_field(tag::ALLOC_ID, FIXString::from(v));
52    }
53
54    /// Gets `AllocID`, Tag 70.
55    pub fn get_alloc_id(&self) -> Result<String, MessageRejectErrorEnum> {
56        let mut fld = field::AllocIDField::new(String::new());
57        self.message.body.get_field(tag::ALLOC_ID, &mut fld.0)?;
58        Ok(fld.value().to_string())
59    }
60
61
62    /// Returns true if `AllocID` is present, Tag 70.
63    pub fn has_alloc_id(&self) -> bool {
64        self.message.body.has(tag::ALLOC_ID)
65    }
66
67
68
69
70    /// Sets `AllocIntermedReqType`, Tag 808.
71    pub fn set_alloc_intermed_req_type(&mut self, v: isize) {
72        self.message.body.set_field(tag::ALLOC_INTERMED_REQ_TYPE, fixer::fix_int::FIXInt::from(v));
73    }
74
75    /// Gets `AllocIntermedReqType`, Tag 808.
76    pub fn get_alloc_intermed_req_type(&self) -> Result<isize, MessageRejectErrorEnum> {
77        let mut fld = field::AllocIntermedReqTypeField::new(0);
78        self.message.body.get_field(tag::ALLOC_INTERMED_REQ_TYPE, &mut fld.0)?;
79        Ok(fld.value())
80    }
81
82
83    /// Returns true if `AllocIntermedReqType` is present, Tag 808.
84    pub fn has_alloc_intermed_req_type(&self) -> bool {
85        self.message.body.has(tag::ALLOC_INTERMED_REQ_TYPE)
86    }
87
88
89
90
91    /// Sets `AllocRejCode`, Tag 88.
92    pub fn set_alloc_rej_code(&mut self, v: isize) {
93        self.message.body.set_field(tag::ALLOC_REJ_CODE, fixer::fix_int::FIXInt::from(v));
94    }
95
96    /// Gets `AllocRejCode`, Tag 88.
97    pub fn get_alloc_rej_code(&self) -> Result<isize, MessageRejectErrorEnum> {
98        let mut fld = field::AllocRejCodeField::new(0);
99        self.message.body.get_field(tag::ALLOC_REJ_CODE, &mut fld.0)?;
100        Ok(fld.value())
101    }
102
103
104    /// Returns true if `AllocRejCode` is present, Tag 88.
105    pub fn has_alloc_rej_code(&self) -> bool {
106        self.message.body.has(tag::ALLOC_REJ_CODE)
107    }
108
109
110
111
112    /// Sets `AllocReportID`, Tag 755.
113    pub fn set_alloc_report_id(&mut self, v: String) {
114        self.message.body.set_field(tag::ALLOC_REPORT_ID, FIXString::from(v));
115    }
116
117    /// Gets `AllocReportID`, Tag 755.
118    pub fn get_alloc_report_id(&self) -> Result<String, MessageRejectErrorEnum> {
119        let mut fld = field::AllocReportIDField::new(String::new());
120        self.message.body.get_field(tag::ALLOC_REPORT_ID, &mut fld.0)?;
121        Ok(fld.value().to_string())
122    }
123
124
125    /// Returns true if `AllocReportID` is present, Tag 755.
126    pub fn has_alloc_report_id(&self) -> bool {
127        self.message.body.has(tag::ALLOC_REPORT_ID)
128    }
129
130
131
132
133    /// Sets `AllocReportType`, Tag 794.
134    pub fn set_alloc_report_type(&mut self, v: isize) {
135        self.message.body.set_field(tag::ALLOC_REPORT_TYPE, fixer::fix_int::FIXInt::from(v));
136    }
137
138    /// Gets `AllocReportType`, Tag 794.
139    pub fn get_alloc_report_type(&self) -> Result<isize, MessageRejectErrorEnum> {
140        let mut fld = field::AllocReportTypeField::new(0);
141        self.message.body.get_field(tag::ALLOC_REPORT_TYPE, &mut fld.0)?;
142        Ok(fld.value())
143    }
144
145
146    /// Returns true if `AllocReportType` is present, Tag 794.
147    pub fn has_alloc_report_type(&self) -> bool {
148        self.message.body.has(tag::ALLOC_REPORT_TYPE)
149    }
150
151
152
153
154    /// Sets `AllocStatus`, Tag 87.
155    pub fn set_alloc_status(&mut self, v: isize) {
156        self.message.body.set_field(tag::ALLOC_STATUS, fixer::fix_int::FIXInt::from(v));
157    }
158
159    /// Gets `AllocStatus`, Tag 87.
160    pub fn get_alloc_status(&self) -> Result<isize, MessageRejectErrorEnum> {
161        let mut fld = field::AllocStatusField::new(0);
162        self.message.body.get_field(tag::ALLOC_STATUS, &mut fld.0)?;
163        Ok(fld.value())
164    }
165
166
167    /// Returns true if `AllocStatus` is present, Tag 87.
168    pub fn has_alloc_status(&self) -> bool {
169        self.message.body.has(tag::ALLOC_STATUS)
170    }
171
172
173
174
175    /// Sets `AllocTransType`, Tag 71.
176    pub fn set_alloc_trans_type(&mut self, v: String) {
177        self.message.body.set_field(tag::ALLOC_TRANS_TYPE, FIXString::from(v));
178    }
179
180    /// Gets `AllocTransType`, Tag 71.
181    pub fn get_alloc_trans_type(&self) -> Result<String, MessageRejectErrorEnum> {
182        let mut fld = field::AllocTransTypeField::new(String::new());
183        self.message.body.get_field(tag::ALLOC_TRANS_TYPE, &mut fld.0)?;
184        Ok(fld.value().to_string())
185    }
186
187
188    /// Returns true if `AllocTransType` is present, Tag 71.
189    pub fn has_alloc_trans_type(&self) -> bool {
190        self.message.body.has(tag::ALLOC_TRANS_TYPE)
191    }
192
193
194
195
196    /// Sets `AvgPxIndicator`, Tag 819.
197    pub fn set_avg_px_indicator(&mut self, v: isize) {
198        self.message.body.set_field(tag::AVG_PX_INDICATOR, fixer::fix_int::FIXInt::from(v));
199    }
200
201    /// Gets `AvgPxIndicator`, Tag 819.
202    pub fn get_avg_px_indicator(&self) -> Result<isize, MessageRejectErrorEnum> {
203        let mut fld = field::AvgPxIndicatorField::new(0);
204        self.message.body.get_field(tag::AVG_PX_INDICATOR, &mut fld.0)?;
205        Ok(fld.value())
206    }
207
208
209    /// Returns true if `AvgPxIndicator` is present, Tag 819.
210    pub fn has_avg_px_indicator(&self) -> bool {
211        self.message.body.has(tag::AVG_PX_INDICATOR)
212    }
213
214
215
216
217    /// Sets `ClearingBusinessDate`, Tag 715.
218    pub fn set_clearing_business_date(&mut self, v: String) {
219        self.message.body.set_field(tag::CLEARING_BUSINESS_DATE, FIXString::from(v));
220    }
221
222    /// Gets `ClearingBusinessDate`, Tag 715.
223    pub fn get_clearing_business_date(&self) -> Result<String, MessageRejectErrorEnum> {
224        let mut fld = field::ClearingBusinessDateField::new(String::new());
225        self.message.body.get_field(tag::CLEARING_BUSINESS_DATE, &mut fld.0)?;
226        Ok(fld.value().to_string())
227    }
228
229
230    /// Returns true if `ClearingBusinessDate` is present, Tag 715.
231    pub fn has_clearing_business_date(&self) -> bool {
232        self.message.body.has(tag::CLEARING_BUSINESS_DATE)
233    }
234
235
236
237
238    /// Sets `EncodedText`, Tag 355.
239    pub fn set_encoded_text(&mut self, v: String) {
240        self.message.body.set_field(tag::ENCODED_TEXT, FIXString::from(v));
241    }
242
243    /// Gets `EncodedText`, Tag 355.
244    pub fn get_encoded_text(&self) -> Result<String, MessageRejectErrorEnum> {
245        let mut fld = field::EncodedTextField::new(String::new());
246        self.message.body.get_field(tag::ENCODED_TEXT, &mut fld.0)?;
247        Ok(fld.value().to_string())
248    }
249
250
251    /// Returns true if `EncodedText` is present, Tag 355.
252    pub fn has_encoded_text(&self) -> bool {
253        self.message.body.has(tag::ENCODED_TEXT)
254    }
255
256
257
258
259    /// Sets `EncodedTextLen`, Tag 354.
260    pub fn set_encoded_text_len(&mut self, v: isize) {
261        self.message.body.set_field(tag::ENCODED_TEXT_LEN, fixer::fix_int::FIXInt::from(v));
262    }
263
264    /// Gets `EncodedTextLen`, Tag 354.
265    pub fn get_encoded_text_len(&self) -> Result<isize, MessageRejectErrorEnum> {
266        let mut fld = field::EncodedTextLenField::new(0);
267        self.message.body.get_field(tag::ENCODED_TEXT_LEN, &mut fld.0)?;
268        Ok(fld.value())
269    }
270
271
272    /// Returns true if `EncodedTextLen` is present, Tag 354.
273    pub fn has_encoded_text_len(&self) -> bool {
274        self.message.body.has(tag::ENCODED_TEXT_LEN)
275    }
276
277
278
279
280    /// Sets `MatchStatus`, Tag 573.
281    pub fn set_match_status(&mut self, v: String) {
282        self.message.body.set_field(tag::MATCH_STATUS, FIXString::from(v));
283    }
284
285    /// Gets `MatchStatus`, Tag 573.
286    pub fn get_match_status(&self) -> Result<String, MessageRejectErrorEnum> {
287        let mut fld = field::MatchStatusField::new(String::new());
288        self.message.body.get_field(tag::MATCH_STATUS, &mut fld.0)?;
289        Ok(fld.value().to_string())
290    }
291
292
293    /// Returns true if `MatchStatus` is present, Tag 573.
294    pub fn has_match_status(&self) -> bool {
295        self.message.body.has(tag::MATCH_STATUS)
296    }
297
298
299
300
301    /// Sets `NoAllocs`, Tag 78.
302    pub fn set_no_allocs(&mut self, v: isize) {
303        self.message.body.set_field(tag::NO_ALLOCS, fixer::fix_int::FIXInt::from(v));
304    }
305
306    /// Gets `NoAllocs`, Tag 78.
307    pub fn get_no_allocs(&self) -> Result<isize, MessageRejectErrorEnum> {
308        let mut fld = field::NoAllocsField::new(0);
309        self.message.body.get_field(tag::NO_ALLOCS, &mut fld.0)?;
310        Ok(fld.value())
311    }
312
313
314    /// Returns true if `NoAllocs` is present, Tag 78.
315    pub fn has_no_allocs(&self) -> bool {
316        self.message.body.has(tag::NO_ALLOCS)
317    }
318
319
320
321
322    /// Sets `NoPartyIDs`, Tag 453.
323    pub fn set_no_party_i_ds(&mut self, v: isize) {
324        self.message.body.set_field(tag::NO_PARTY_I_DS, fixer::fix_int::FIXInt::from(v));
325    }
326
327    /// Gets `NoPartyIDs`, Tag 453.
328    pub fn get_no_party_i_ds(&self) -> Result<isize, MessageRejectErrorEnum> {
329        let mut fld = field::NoPartyIDsField::new(0);
330        self.message.body.get_field(tag::NO_PARTY_I_DS, &mut fld.0)?;
331        Ok(fld.value())
332    }
333
334
335    /// Returns true if `NoPartyIDs` is present, Tag 453.
336    pub fn has_no_party_i_ds(&self) -> bool {
337        self.message.body.has(tag::NO_PARTY_I_DS)
338    }
339
340
341
342
343    /// Sets `Product`, Tag 460.
344    pub fn set_product(&mut self, v: isize) {
345        self.message.body.set_field(tag::PRODUCT, fixer::fix_int::FIXInt::from(v));
346    }
347
348    /// Gets `Product`, Tag 460.
349    pub fn get_product(&self) -> Result<isize, MessageRejectErrorEnum> {
350        let mut fld = field::ProductField::new(0);
351        self.message.body.get_field(tag::PRODUCT, &mut fld.0)?;
352        Ok(fld.value())
353    }
354
355
356    /// Returns true if `Product` is present, Tag 460.
357    pub fn has_product(&self) -> bool {
358        self.message.body.has(tag::PRODUCT)
359    }
360
361
362
363
364    /// Sets `Quantity`, Tag 53.
365    pub fn set_quantity(&mut self, val: Decimal, scale: i32) {
366        self.message.body.set_field(tag::QUANTITY, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
367    }
368
369    /// Gets `Quantity`, Tag 53.
370    pub fn get_quantity(&self) -> Result<Decimal, MessageRejectErrorEnum> {
371        let mut fld = field::QuantityField::new(Decimal::ZERO, 0);
372        self.message.body.get_field(tag::QUANTITY, &mut fld.0)?;
373        Ok(fld.value())
374    }
375
376
377    /// Returns true if `Quantity` is present, Tag 53.
378    pub fn has_quantity(&self) -> bool {
379        self.message.body.has(tag::QUANTITY)
380    }
381
382
383
384
385    /// Sets `SecondaryAllocID`, Tag 793.
386    pub fn set_secondary_alloc_id(&mut self, v: String) {
387        self.message.body.set_field(tag::SECONDARY_ALLOC_ID, FIXString::from(v));
388    }
389
390    /// Gets `SecondaryAllocID`, Tag 793.
391    pub fn get_secondary_alloc_id(&self) -> Result<String, MessageRejectErrorEnum> {
392        let mut fld = field::SecondaryAllocIDField::new(String::new());
393        self.message.body.get_field(tag::SECONDARY_ALLOC_ID, &mut fld.0)?;
394        Ok(fld.value().to_string())
395    }
396
397
398    /// Returns true if `SecondaryAllocID` is present, Tag 793.
399    pub fn has_secondary_alloc_id(&self) -> bool {
400        self.message.body.has(tag::SECONDARY_ALLOC_ID)
401    }
402
403
404
405
406    /// Sets `SecurityType`, Tag 167.
407    pub fn set_security_type(&mut self, v: String) {
408        self.message.body.set_field(tag::SECURITY_TYPE, FIXString::from(v));
409    }
410
411    /// Gets `SecurityType`, Tag 167.
412    pub fn get_security_type(&self) -> Result<String, MessageRejectErrorEnum> {
413        let mut fld = field::SecurityTypeField::new(String::new());
414        self.message.body.get_field(tag::SECURITY_TYPE, &mut fld.0)?;
415        Ok(fld.value().to_string())
416    }
417
418
419    /// Returns true if `SecurityType` is present, Tag 167.
420    pub fn has_security_type(&self) -> bool {
421        self.message.body.has(tag::SECURITY_TYPE)
422    }
423
424
425
426
427    /// Sets `Text`, Tag 58.
428    pub fn set_text(&mut self, v: String) {
429        self.message.body.set_field(tag::TEXT, FIXString::from(v));
430    }
431
432    /// Gets `Text`, Tag 58.
433    pub fn get_text(&self) -> Result<String, MessageRejectErrorEnum> {
434        let mut fld = field::TextField::new(String::new());
435        self.message.body.get_field(tag::TEXT, &mut fld.0)?;
436        Ok(fld.value().to_string())
437    }
438
439
440    /// Returns true if `Text` is present, Tag 58.
441    pub fn has_text(&self) -> bool {
442        self.message.body.has(tag::TEXT)
443    }
444
445
446
447
448    /// Sets `TradeDate`, Tag 75.
449    pub fn set_trade_date(&mut self, v: String) {
450        self.message.body.set_field(tag::TRADE_DATE, FIXString::from(v));
451    }
452
453    /// Gets `TradeDate`, Tag 75.
454    pub fn get_trade_date(&self) -> Result<String, MessageRejectErrorEnum> {
455        let mut fld = field::TradeDateField::new(String::new());
456        self.message.body.get_field(tag::TRADE_DATE, &mut fld.0)?;
457        Ok(fld.value().to_string())
458    }
459
460
461    /// Returns true if `TradeDate` is present, Tag 75.
462    pub fn has_trade_date(&self) -> bool {
463        self.message.body.has(tag::TRADE_DATE)
464    }
465
466
467
468
469    /// Sets `TransactTime`, Tag 60.
470    pub fn set_transact_time(&mut self, v: Timestamp) {
471        self.message.body.set_field(tag::TRANSACT_TIME, fixer::fix_utc_timestamp::FIXUTCTimestamp {
472            time: v,
473            precision: fixer::fix_utc_timestamp::TimestampPrecision::Millis,
474        });
475    }
476
477    /// Gets `TransactTime`, Tag 60.
478    pub fn get_transact_time(&self) -> Result<Timestamp, MessageRejectErrorEnum> {
479        let mut fld = field::TransactTimeField::new(Timestamp::UNIX_EPOCH);
480        self.message.body.get_field(tag::TRANSACT_TIME, &mut fld.0)?;
481        Ok(fld.value())
482    }
483
484
485    /// Returns true if `TransactTime` is present, Tag 60.
486    pub fn has_transact_time(&self) -> bool {
487        self.message.body.has(tag::TRANSACT_TIME)
488    }
489
490
491}
492
493/// `RouteOut` is the callback type for routing `AllocationReportAck` messages.
494pub type RouteOut = fn(msg: AllocationReportAck, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
495
496/// Route type returned by the `route` function.
497pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
498
499/// Returns the begin string, message type, and route function for `AllocationReportAck`.
500pub fn route(router: RouteOut) -> Route {
501    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
502        router(AllocationReportAck::from_message(msg.clone()), session_id)
503    };
504    ("9", "AT", Box::new(r))
505}