Skip to main content

fixer_fix/fix50sp2/
application_message_request_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 crate::field;
14use crate::tag;
15
16/// `ApplicationMessageRequestAck` is the `fix50sp2` `ApplicationMessageRequestAck` type, `MsgType` = BX.
17pub struct ApplicationMessageRequestAck {
18    pub message: Message,
19}
20
21impl ApplicationMessageRequestAck {
22    /// Creates a new `ApplicationMessageRequestAck` with required fields.
23    pub fn new(appl_response_id: field::ApplResponseIDField) -> Self {
24        let mut msg = Message::new();
25        msg.header.set_field(tag::MSG_TYPE, FIXString::from("BX".to_string()));
26
27        msg.body.set_field(tag::APPL_RESPONSE_ID, appl_response_id.0);
28
29        Self { message: msg }
30    }
31
32    /// Creates a `ApplicationMessageRequestAck` from an existing `Message`.
33    pub fn from_message(msg: Message) -> Self {
34        Self { message: msg }
35    }
36
37    /// Returns the underlying `Message`.
38    pub fn to_message(self) -> Message {
39        self.message
40    }
41
42
43
44
45    /// Sets `ApplReqID`, Tag 1346.
46    pub fn set_appl_req_id(&mut self, v: String) {
47        self.message.body.set_field(tag::APPL_REQ_ID, FIXString::from(v));
48    }
49
50    /// Gets `ApplReqID`, Tag 1346.
51    pub fn get_appl_req_id(&self) -> Result<String, MessageRejectErrorEnum> {
52        let mut fld = field::ApplReqIDField::new(String::new());
53        self.message.body.get_field(tag::APPL_REQ_ID, &mut fld.0)?;
54        Ok(fld.value().to_string())
55    }
56
57
58    /// Returns true if `ApplReqID` is present, Tag 1346.
59    pub fn has_appl_req_id(&self) -> bool {
60        self.message.body.has(tag::APPL_REQ_ID)
61    }
62
63
64
65
66    /// Sets `ApplReqType`, Tag 1347.
67    pub fn set_appl_req_type(&mut self, v: isize) {
68        self.message.body.set_field(tag::APPL_REQ_TYPE, fixer::fix_int::FIXInt::from(v));
69    }
70
71    /// Gets `ApplReqType`, Tag 1347.
72    pub fn get_appl_req_type(&self) -> Result<isize, MessageRejectErrorEnum> {
73        let mut fld = field::ApplReqTypeField::new(0);
74        self.message.body.get_field(tag::APPL_REQ_TYPE, &mut fld.0)?;
75        Ok(fld.value())
76    }
77
78
79    /// Returns true if `ApplReqType` is present, Tag 1347.
80    pub fn has_appl_req_type(&self) -> bool {
81        self.message.body.has(tag::APPL_REQ_TYPE)
82    }
83
84
85
86
87    /// Sets `ApplResponseID`, Tag 1353.
88    pub fn set_appl_response_id(&mut self, v: String) {
89        self.message.body.set_field(tag::APPL_RESPONSE_ID, FIXString::from(v));
90    }
91
92    /// Gets `ApplResponseID`, Tag 1353.
93    pub fn get_appl_response_id(&self) -> Result<String, MessageRejectErrorEnum> {
94        let mut fld = field::ApplResponseIDField::new(String::new());
95        self.message.body.get_field(tag::APPL_RESPONSE_ID, &mut fld.0)?;
96        Ok(fld.value().to_string())
97    }
98
99
100    /// Returns true if `ApplResponseID` is present, Tag 1353.
101    pub fn has_appl_response_id(&self) -> bool {
102        self.message.body.has(tag::APPL_RESPONSE_ID)
103    }
104
105
106
107
108    /// Sets `ApplResponseType`, Tag 1348.
109    pub fn set_appl_response_type(&mut self, v: isize) {
110        self.message.body.set_field(tag::APPL_RESPONSE_TYPE, fixer::fix_int::FIXInt::from(v));
111    }
112
113    /// Gets `ApplResponseType`, Tag 1348.
114    pub fn get_appl_response_type(&self) -> Result<isize, MessageRejectErrorEnum> {
115        let mut fld = field::ApplResponseTypeField::new(0);
116        self.message.body.get_field(tag::APPL_RESPONSE_TYPE, &mut fld.0)?;
117        Ok(fld.value())
118    }
119
120
121    /// Returns true if `ApplResponseType` is present, Tag 1348.
122    pub fn has_appl_response_type(&self) -> bool {
123        self.message.body.has(tag::APPL_RESPONSE_TYPE)
124    }
125
126
127
128
129    /// Sets `ApplTotalMessageCount`, Tag 1349.
130    pub fn set_appl_total_message_count(&mut self, v: isize) {
131        self.message.body.set_field(tag::APPL_TOTAL_MESSAGE_COUNT, fixer::fix_int::FIXInt::from(v));
132    }
133
134    /// Gets `ApplTotalMessageCount`, Tag 1349.
135    pub fn get_appl_total_message_count(&self) -> Result<isize, MessageRejectErrorEnum> {
136        let mut fld = field::ApplTotalMessageCountField::new(0);
137        self.message.body.get_field(tag::APPL_TOTAL_MESSAGE_COUNT, &mut fld.0)?;
138        Ok(fld.value())
139    }
140
141
142    /// Returns true if `ApplTotalMessageCount` is present, Tag 1349.
143    pub fn has_appl_total_message_count(&self) -> bool {
144        self.message.body.has(tag::APPL_TOTAL_MESSAGE_COUNT)
145    }
146
147
148
149
150    /// Sets `EncodedText`, Tag 355.
151    pub fn set_encoded_text(&mut self, v: String) {
152        self.message.body.set_field(tag::ENCODED_TEXT, FIXString::from(v));
153    }
154
155    /// Gets `EncodedText`, Tag 355.
156    pub fn get_encoded_text(&self) -> Result<String, MessageRejectErrorEnum> {
157        let mut fld = field::EncodedTextField::new(String::new());
158        self.message.body.get_field(tag::ENCODED_TEXT, &mut fld.0)?;
159        Ok(fld.value().to_string())
160    }
161
162
163    /// Returns true if `EncodedText` is present, Tag 355.
164    pub fn has_encoded_text(&self) -> bool {
165        self.message.body.has(tag::ENCODED_TEXT)
166    }
167
168
169
170
171    /// Sets `EncodedTextLen`, Tag 354.
172    pub fn set_encoded_text_len(&mut self, v: isize) {
173        self.message.body.set_field(tag::ENCODED_TEXT_LEN, fixer::fix_int::FIXInt::from(v));
174    }
175
176    /// Gets `EncodedTextLen`, Tag 354.
177    pub fn get_encoded_text_len(&self) -> Result<isize, MessageRejectErrorEnum> {
178        let mut fld = field::EncodedTextLenField::new(0);
179        self.message.body.get_field(tag::ENCODED_TEXT_LEN, &mut fld.0)?;
180        Ok(fld.value())
181    }
182
183
184    /// Returns true if `EncodedTextLen` is present, Tag 354.
185    pub fn has_encoded_text_len(&self) -> bool {
186        self.message.body.has(tag::ENCODED_TEXT_LEN)
187    }
188
189
190
191
192    /// Sets `NoApplIDs`, Tag 1351.
193    pub fn set_no_appl_i_ds(&mut self, v: isize) {
194        self.message.body.set_field(tag::NO_APPL_I_DS, fixer::fix_int::FIXInt::from(v));
195    }
196
197    /// Gets `NoApplIDs`, Tag 1351.
198    pub fn get_no_appl_i_ds(&self) -> Result<isize, MessageRejectErrorEnum> {
199        let mut fld = field::NoApplIDsField::new(0);
200        self.message.body.get_field(tag::NO_APPL_I_DS, &mut fld.0)?;
201        Ok(fld.value())
202    }
203
204
205    /// Returns true if `NoApplIDs` is present, Tag 1351.
206    pub fn has_no_appl_i_ds(&self) -> bool {
207        self.message.body.has(tag::NO_APPL_I_DS)
208    }
209
210
211
212
213    /// Sets `NoPartyIDs`, Tag 453.
214    pub fn set_no_party_i_ds(&mut self, v: isize) {
215        self.message.body.set_field(tag::NO_PARTY_I_DS, fixer::fix_int::FIXInt::from(v));
216    }
217
218    /// Gets `NoPartyIDs`, Tag 453.
219    pub fn get_no_party_i_ds(&self) -> Result<isize, MessageRejectErrorEnum> {
220        let mut fld = field::NoPartyIDsField::new(0);
221        self.message.body.get_field(tag::NO_PARTY_I_DS, &mut fld.0)?;
222        Ok(fld.value())
223    }
224
225
226    /// Returns true if `NoPartyIDs` is present, Tag 453.
227    pub fn has_no_party_i_ds(&self) -> bool {
228        self.message.body.has(tag::NO_PARTY_I_DS)
229    }
230
231
232
233
234    /// Sets `Text`, Tag 58.
235    pub fn set_text(&mut self, v: String) {
236        self.message.body.set_field(tag::TEXT, FIXString::from(v));
237    }
238
239    /// Gets `Text`, Tag 58.
240    pub fn get_text(&self) -> Result<String, MessageRejectErrorEnum> {
241        let mut fld = field::TextField::new(String::new());
242        self.message.body.get_field(tag::TEXT, &mut fld.0)?;
243        Ok(fld.value().to_string())
244    }
245
246
247    /// Returns true if `Text` is present, Tag 58.
248    pub fn has_text(&self) -> bool {
249        self.message.body.has(tag::TEXT)
250    }
251
252
253}
254
255/// `RouteOut` is the callback type for routing `ApplicationMessageRequestAck` messages.
256pub type RouteOut = fn(msg: ApplicationMessageRequestAck, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
257
258/// Route type returned by the `route` function.
259pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
260
261/// Returns the begin string, message type, and route function for `ApplicationMessageRequestAck`.
262pub fn route(router: RouteOut) -> Route {
263    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
264        router(ApplicationMessageRequestAck::from_message(msg.clone()), session_id)
265    };
266    ("9", "BX", Box::new(r))
267}