Skip to main content

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