fixer_fix/fix50sp2/
application_message_request_ack.rs1#![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
16pub struct ApplicationMessageRequestAck {
18 pub message: Message,
19}
20
21impl ApplicationMessageRequestAck {
22 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 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_req_id(&mut self, v: String) {
47 self.message.body.set_field(tag::APPL_REQ_ID, FIXString::from(v));
48 }
49
50 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 pub fn has_appl_req_id(&self) -> bool {
60 self.message.body.has(tag::APPL_REQ_ID)
61 }
62
63
64
65
66 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 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 pub fn has_appl_req_type(&self) -> bool {
81 self.message.body.has(tag::APPL_REQ_TYPE)
82 }
83
84
85
86
87 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 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 pub fn has_appl_response_id(&self) -> bool {
102 self.message.body.has(tag::APPL_RESPONSE_ID)
103 }
104
105
106
107
108 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 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 pub fn has_appl_response_type(&self) -> bool {
123 self.message.body.has(tag::APPL_RESPONSE_TYPE)
124 }
125
126
127
128
129 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 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 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 pub fn set_encoded_text(&mut self, v: String) {
152 self.message.body.set_field(tag::ENCODED_TEXT, FIXString::from(v));
153 }
154
155 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 pub fn has_encoded_text(&self) -> bool {
165 self.message.body.has(tag::ENCODED_TEXT)
166 }
167
168
169
170
171 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 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 pub fn has_encoded_text_len(&self) -> bool {
186 self.message.body.has(tag::ENCODED_TEXT_LEN)
187 }
188
189
190
191
192 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 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 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 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 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 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 pub fn set_text(&mut self, v: String) {
236 self.message.body.set_field(tag::TEXT, FIXString::from(v));
237 }
238
239 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 pub fn has_text(&self) -> bool {
249 self.message.body.has(tag::TEXT)
250 }
251
252
253}
254
255pub type RouteOut = fn(msg: ApplicationMessageRequestAck, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
257
258pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
260
261pub 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}