Skip to main content

fixer_fix/fix50sp1/
security_types.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/// `SecurityTypes` is the `fix50sp1` `SecurityTypes` type, `MsgType` = w.
17pub struct SecurityTypes {
18    pub message: Message,
19}
20
21impl SecurityTypes {
22    /// Creates a new `SecurityTypes` with required fields.
23    pub fn new(security_req_id: field::SecurityReqIDField, security_response_id: field::SecurityResponseIDField, security_response_type: field::SecurityResponseTypeField) -> Self {
24        let mut msg = Message::new();
25        msg.header.set_field(tag::MSG_TYPE, FIXString::from("w".to_string()));
26
27        msg.body.set_field(tag::SECURITY_REQ_ID, security_req_id.0);
28
29        msg.body.set_field(tag::SECURITY_RESPONSE_ID, security_response_id.0);
30
31        msg.body.set_field(tag::SECURITY_RESPONSE_TYPE, security_response_type.0);
32
33        Self { message: msg }
34    }
35
36    /// Creates a `SecurityTypes` 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 `ApplID`, Tag 1180.
50    pub fn set_appl_id(&mut self, v: String) {
51        self.message.body.set_field(tag::APPL_ID, FIXString::from(v));
52    }
53
54    /// Gets `ApplID`, Tag 1180.
55    pub fn get_appl_id(&self) -> Result<String, MessageRejectErrorEnum> {
56        let mut fld = field::ApplIDField::new(String::new());
57        self.message.body.get_field(tag::APPL_ID, &mut fld.0)?;
58        Ok(fld.value().to_string())
59    }
60
61
62    /// Returns true if `ApplID` is present, Tag 1180.
63    pub fn has_appl_id(&self) -> bool {
64        self.message.body.has(tag::APPL_ID)
65    }
66
67
68
69
70    /// Sets `ApplLastSeqNum`, Tag 1350.
71    pub fn set_appl_last_seq_num(&mut self, v: isize) {
72        self.message.body.set_field(tag::APPL_LAST_SEQ_NUM, fixer::fix_int::FIXInt::from(v));
73    }
74
75    /// Gets `ApplLastSeqNum`, Tag 1350.
76    pub fn get_appl_last_seq_num(&self) -> Result<isize, MessageRejectErrorEnum> {
77        let mut fld = field::ApplLastSeqNumField::new(0);
78        self.message.body.get_field(tag::APPL_LAST_SEQ_NUM, &mut fld.0)?;
79        Ok(fld.value())
80    }
81
82
83    /// Returns true if `ApplLastSeqNum` is present, Tag 1350.
84    pub fn has_appl_last_seq_num(&self) -> bool {
85        self.message.body.has(tag::APPL_LAST_SEQ_NUM)
86    }
87
88
89
90
91    /// Sets `ApplResendFlag`, Tag 1352.
92    pub fn set_appl_resend_flag(&mut self, v: bool) {
93        self.message.body.set_field(tag::APPL_RESEND_FLAG, fixer::fix_boolean::FIXBoolean::from(v));
94    }
95
96    /// Gets `ApplResendFlag`, Tag 1352.
97    pub fn get_appl_resend_flag(&self) -> Result<bool, MessageRejectErrorEnum> {
98        let mut fld = field::ApplResendFlagField::new(false);
99        self.message.body.get_field(tag::APPL_RESEND_FLAG, &mut fld.0)?;
100        Ok(fld.value())
101    }
102
103
104    /// Returns true if `ApplResendFlag` is present, Tag 1352.
105    pub fn has_appl_resend_flag(&self) -> bool {
106        self.message.body.has(tag::APPL_RESEND_FLAG)
107    }
108
109
110
111
112    /// Sets `ApplSeqNum`, Tag 1181.
113    pub fn set_appl_seq_num(&mut self, v: isize) {
114        self.message.body.set_field(tag::APPL_SEQ_NUM, fixer::fix_int::FIXInt::from(v));
115    }
116
117    /// Gets `ApplSeqNum`, Tag 1181.
118    pub fn get_appl_seq_num(&self) -> Result<isize, MessageRejectErrorEnum> {
119        let mut fld = field::ApplSeqNumField::new(0);
120        self.message.body.get_field(tag::APPL_SEQ_NUM, &mut fld.0)?;
121        Ok(fld.value())
122    }
123
124
125    /// Returns true if `ApplSeqNum` is present, Tag 1181.
126    pub fn has_appl_seq_num(&self) -> bool {
127        self.message.body.has(tag::APPL_SEQ_NUM)
128    }
129
130
131
132
133    /// Sets `EncodedText`, Tag 355.
134    pub fn set_encoded_text(&mut self, v: String) {
135        self.message.body.set_field(tag::ENCODED_TEXT, FIXString::from(v));
136    }
137
138    /// Gets `EncodedText`, Tag 355.
139    pub fn get_encoded_text(&self) -> Result<String, MessageRejectErrorEnum> {
140        let mut fld = field::EncodedTextField::new(String::new());
141        self.message.body.get_field(tag::ENCODED_TEXT, &mut fld.0)?;
142        Ok(fld.value().to_string())
143    }
144
145
146    /// Returns true if `EncodedText` is present, Tag 355.
147    pub fn has_encoded_text(&self) -> bool {
148        self.message.body.has(tag::ENCODED_TEXT)
149    }
150
151
152
153
154    /// Sets `EncodedTextLen`, Tag 354.
155    pub fn set_encoded_text_len(&mut self, v: isize) {
156        self.message.body.set_field(tag::ENCODED_TEXT_LEN, fixer::fix_int::FIXInt::from(v));
157    }
158
159    /// Gets `EncodedTextLen`, Tag 354.
160    pub fn get_encoded_text_len(&self) -> Result<isize, MessageRejectErrorEnum> {
161        let mut fld = field::EncodedTextLenField::new(0);
162        self.message.body.get_field(tag::ENCODED_TEXT_LEN, &mut fld.0)?;
163        Ok(fld.value())
164    }
165
166
167    /// Returns true if `EncodedTextLen` is present, Tag 354.
168    pub fn has_encoded_text_len(&self) -> bool {
169        self.message.body.has(tag::ENCODED_TEXT_LEN)
170    }
171
172
173
174
175    /// Sets `LastFragment`, Tag 893.
176    pub fn set_last_fragment(&mut self, v: bool) {
177        self.message.body.set_field(tag::LAST_FRAGMENT, fixer::fix_boolean::FIXBoolean::from(v));
178    }
179
180    /// Gets `LastFragment`, Tag 893.
181    pub fn get_last_fragment(&self) -> Result<bool, MessageRejectErrorEnum> {
182        let mut fld = field::LastFragmentField::new(false);
183        self.message.body.get_field(tag::LAST_FRAGMENT, &mut fld.0)?;
184        Ok(fld.value())
185    }
186
187
188    /// Returns true if `LastFragment` is present, Tag 893.
189    pub fn has_last_fragment(&self) -> bool {
190        self.message.body.has(tag::LAST_FRAGMENT)
191    }
192
193
194
195
196    /// Sets `MarketID`, Tag 1301.
197    pub fn set_market_id(&mut self, v: String) {
198        self.message.body.set_field(tag::MARKET_ID, FIXString::from(v));
199    }
200
201    /// Gets `MarketID`, Tag 1301.
202    pub fn get_market_id(&self) -> Result<String, MessageRejectErrorEnum> {
203        let mut fld = field::MarketIDField::new(String::new());
204        self.message.body.get_field(tag::MARKET_ID, &mut fld.0)?;
205        Ok(fld.value().to_string())
206    }
207
208
209    /// Returns true if `MarketID` is present, Tag 1301.
210    pub fn has_market_id(&self) -> bool {
211        self.message.body.has(tag::MARKET_ID)
212    }
213
214
215
216
217    /// Sets `MarketSegmentID`, Tag 1300.
218    pub fn set_market_segment_id(&mut self, v: String) {
219        self.message.body.set_field(tag::MARKET_SEGMENT_ID, FIXString::from(v));
220    }
221
222    /// Gets `MarketSegmentID`, Tag 1300.
223    pub fn get_market_segment_id(&self) -> Result<String, MessageRejectErrorEnum> {
224        let mut fld = field::MarketSegmentIDField::new(String::new());
225        self.message.body.get_field(tag::MARKET_SEGMENT_ID, &mut fld.0)?;
226        Ok(fld.value().to_string())
227    }
228
229
230    /// Returns true if `MarketSegmentID` is present, Tag 1300.
231    pub fn has_market_segment_id(&self) -> bool {
232        self.message.body.has(tag::MARKET_SEGMENT_ID)
233    }
234
235
236
237
238    /// Sets `NoSecurityTypes`, Tag 558.
239    pub fn set_no_security_types(&mut self, v: isize) {
240        self.message.body.set_field(tag::NO_SECURITY_TYPES, fixer::fix_int::FIXInt::from(v));
241    }
242
243    /// Gets `NoSecurityTypes`, Tag 558.
244    pub fn get_no_security_types(&self) -> Result<isize, MessageRejectErrorEnum> {
245        let mut fld = field::NoSecurityTypesField::new(0);
246        self.message.body.get_field(tag::NO_SECURITY_TYPES, &mut fld.0)?;
247        Ok(fld.value())
248    }
249
250
251    /// Returns true if `NoSecurityTypes` is present, Tag 558.
252    pub fn has_no_security_types(&self) -> bool {
253        self.message.body.has(tag::NO_SECURITY_TYPES)
254    }
255
256
257
258
259    /// Sets `SecurityReqID`, Tag 320.
260    pub fn set_security_req_id(&mut self, v: String) {
261        self.message.body.set_field(tag::SECURITY_REQ_ID, FIXString::from(v));
262    }
263
264    /// Gets `SecurityReqID`, Tag 320.
265    pub fn get_security_req_id(&self) -> Result<String, MessageRejectErrorEnum> {
266        let mut fld = field::SecurityReqIDField::new(String::new());
267        self.message.body.get_field(tag::SECURITY_REQ_ID, &mut fld.0)?;
268        Ok(fld.value().to_string())
269    }
270
271
272    /// Returns true if `SecurityReqID` is present, Tag 320.
273    pub fn has_security_req_id(&self) -> bool {
274        self.message.body.has(tag::SECURITY_REQ_ID)
275    }
276
277
278
279
280    /// Sets `SecurityResponseID`, Tag 322.
281    pub fn set_security_response_id(&mut self, v: String) {
282        self.message.body.set_field(tag::SECURITY_RESPONSE_ID, FIXString::from(v));
283    }
284
285    /// Gets `SecurityResponseID`, Tag 322.
286    pub fn get_security_response_id(&self) -> Result<String, MessageRejectErrorEnum> {
287        let mut fld = field::SecurityResponseIDField::new(String::new());
288        self.message.body.get_field(tag::SECURITY_RESPONSE_ID, &mut fld.0)?;
289        Ok(fld.value().to_string())
290    }
291
292
293    /// Returns true if `SecurityResponseID` is present, Tag 322.
294    pub fn has_security_response_id(&self) -> bool {
295        self.message.body.has(tag::SECURITY_RESPONSE_ID)
296    }
297
298
299
300
301    /// Sets `SecurityResponseType`, Tag 323.
302    pub fn set_security_response_type(&mut self, v: isize) {
303        self.message.body.set_field(tag::SECURITY_RESPONSE_TYPE, fixer::fix_int::FIXInt::from(v));
304    }
305
306    /// Gets `SecurityResponseType`, Tag 323.
307    pub fn get_security_response_type(&self) -> Result<isize, MessageRejectErrorEnum> {
308        let mut fld = field::SecurityResponseTypeField::new(0);
309        self.message.body.get_field(tag::SECURITY_RESPONSE_TYPE, &mut fld.0)?;
310        Ok(fld.value())
311    }
312
313
314    /// Returns true if `SecurityResponseType` is present, Tag 323.
315    pub fn has_security_response_type(&self) -> bool {
316        self.message.body.has(tag::SECURITY_RESPONSE_TYPE)
317    }
318
319
320
321
322    /// Sets `SubscriptionRequestType`, Tag 263.
323    pub fn set_subscription_request_type(&mut self, v: String) {
324        self.message.body.set_field(tag::SUBSCRIPTION_REQUEST_TYPE, FIXString::from(v));
325    }
326
327    /// Gets `SubscriptionRequestType`, Tag 263.
328    pub fn get_subscription_request_type(&self) -> Result<String, MessageRejectErrorEnum> {
329        let mut fld = field::SubscriptionRequestTypeField::new(String::new());
330        self.message.body.get_field(tag::SUBSCRIPTION_REQUEST_TYPE, &mut fld.0)?;
331        Ok(fld.value().to_string())
332    }
333
334
335    /// Returns true if `SubscriptionRequestType` is present, Tag 263.
336    pub fn has_subscription_request_type(&self) -> bool {
337        self.message.body.has(tag::SUBSCRIPTION_REQUEST_TYPE)
338    }
339
340
341
342
343    /// Sets `Text`, Tag 58.
344    pub fn set_text(&mut self, v: String) {
345        self.message.body.set_field(tag::TEXT, FIXString::from(v));
346    }
347
348    /// Gets `Text`, Tag 58.
349    pub fn get_text(&self) -> Result<String, MessageRejectErrorEnum> {
350        let mut fld = field::TextField::new(String::new());
351        self.message.body.get_field(tag::TEXT, &mut fld.0)?;
352        Ok(fld.value().to_string())
353    }
354
355
356    /// Returns true if `Text` is present, Tag 58.
357    pub fn has_text(&self) -> bool {
358        self.message.body.has(tag::TEXT)
359    }
360
361
362
363
364    /// Sets `TotNoSecurityTypes`, Tag 557.
365    pub fn set_tot_no_security_types(&mut self, v: isize) {
366        self.message.body.set_field(tag::TOT_NO_SECURITY_TYPES, fixer::fix_int::FIXInt::from(v));
367    }
368
369    /// Gets `TotNoSecurityTypes`, Tag 557.
370    pub fn get_tot_no_security_types(&self) -> Result<isize, MessageRejectErrorEnum> {
371        let mut fld = field::TotNoSecurityTypesField::new(0);
372        self.message.body.get_field(tag::TOT_NO_SECURITY_TYPES, &mut fld.0)?;
373        Ok(fld.value())
374    }
375
376
377    /// Returns true if `TotNoSecurityTypes` is present, Tag 557.
378    pub fn has_tot_no_security_types(&self) -> bool {
379        self.message.body.has(tag::TOT_NO_SECURITY_TYPES)
380    }
381
382
383
384
385    /// Sets `TradingSessionID`, Tag 336.
386    pub fn set_trading_session_id(&mut self, v: String) {
387        self.message.body.set_field(tag::TRADING_SESSION_ID, FIXString::from(v));
388    }
389
390    /// Gets `TradingSessionID`, Tag 336.
391    pub fn get_trading_session_id(&self) -> Result<String, MessageRejectErrorEnum> {
392        let mut fld = field::TradingSessionIDField::new(String::new());
393        self.message.body.get_field(tag::TRADING_SESSION_ID, &mut fld.0)?;
394        Ok(fld.value().to_string())
395    }
396
397
398    /// Returns true if `TradingSessionID` is present, Tag 336.
399    pub fn has_trading_session_id(&self) -> bool {
400        self.message.body.has(tag::TRADING_SESSION_ID)
401    }
402
403
404
405
406    /// Sets `TradingSessionSubID`, Tag 625.
407    pub fn set_trading_session_sub_id(&mut self, v: String) {
408        self.message.body.set_field(tag::TRADING_SESSION_SUB_ID, FIXString::from(v));
409    }
410
411    /// Gets `TradingSessionSubID`, Tag 625.
412    pub fn get_trading_session_sub_id(&self) -> Result<String, MessageRejectErrorEnum> {
413        let mut fld = field::TradingSessionSubIDField::new(String::new());
414        self.message.body.get_field(tag::TRADING_SESSION_SUB_ID, &mut fld.0)?;
415        Ok(fld.value().to_string())
416    }
417
418
419    /// Returns true if `TradingSessionSubID` is present, Tag 625.
420    pub fn has_trading_session_sub_id(&self) -> bool {
421        self.message.body.has(tag::TRADING_SESSION_SUB_ID)
422    }
423
424
425}
426
427/// `RouteOut` is the callback type for routing `SecurityTypes` messages.
428pub type RouteOut = fn(msg: SecurityTypes, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
429
430/// Route type returned by the `route` function.
431pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
432
433/// Returns the begin string, message type, and route function for `SecurityTypes`.
434pub fn route(router: RouteOut) -> Route {
435    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
436        router(SecurityTypes::from_message(msg.clone()), session_id)
437    };
438    ("8", "w", Box::new(r))
439}