Skip to main content

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