Skip to main content

fixer_fix/fix50/
security_list.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/// `SecurityList` is the `fix50` `SecurityList` type, `MsgType` = y.
17pub struct SecurityList {
18    pub message: Message,
19}
20
21impl SecurityList {
22    /// Creates a new `SecurityList` with required fields.
23    pub fn new() -> Self {
24        let mut msg = Message::new();
25        msg.header.set_field(tag::MSG_TYPE, FIXString::from("y".to_string()));
26
27        Self { message: msg }
28    }
29
30    /// Creates a `SecurityList` from an existing `Message`.
31    pub fn from_message(msg: Message) -> Self {
32        Self { message: msg }
33    }
34
35    /// Returns the underlying `Message`.
36    pub fn to_message(self) -> Message {
37        self.message
38    }
39
40
41
42
43    /// Sets `ClearingBusinessDate`, Tag 715.
44    pub fn set_clearing_business_date(&mut self, v: String) {
45        self.message.body.set_field(tag::CLEARING_BUSINESS_DATE, FIXString::from(v));
46    }
47
48    /// Gets `ClearingBusinessDate`, Tag 715.
49    pub fn get_clearing_business_date(&self) -> Result<String, MessageRejectErrorEnum> {
50        let mut fld = field::ClearingBusinessDateField::new(String::new());
51        self.message.body.get_field(tag::CLEARING_BUSINESS_DATE, &mut fld.0)?;
52        Ok(fld.value().to_string())
53    }
54
55
56    /// Returns true if `ClearingBusinessDate` is present, Tag 715.
57    pub fn has_clearing_business_date(&self) -> bool {
58        self.message.body.has(tag::CLEARING_BUSINESS_DATE)
59    }
60
61
62
63
64    /// Sets `LastFragment`, Tag 893.
65    pub fn set_last_fragment(&mut self, v: bool) {
66        self.message.body.set_field(tag::LAST_FRAGMENT, fixer::fix_boolean::FIXBoolean::from(v));
67    }
68
69    /// Gets `LastFragment`, Tag 893.
70    pub fn get_last_fragment(&self) -> Result<bool, MessageRejectErrorEnum> {
71        let mut fld = field::LastFragmentField::new(false);
72        self.message.body.get_field(tag::LAST_FRAGMENT, &mut fld.0)?;
73        Ok(fld.value())
74    }
75
76
77    /// Returns true if `LastFragment` is present, Tag 893.
78    pub fn has_last_fragment(&self) -> bool {
79        self.message.body.has(tag::LAST_FRAGMENT)
80    }
81
82
83
84
85    /// Sets `NoRelatedSym`, Tag 146.
86    pub fn set_no_related_sym(&mut self, v: isize) {
87        self.message.body.set_field(tag::NO_RELATED_SYM, fixer::fix_int::FIXInt::from(v));
88    }
89
90    /// Gets `NoRelatedSym`, Tag 146.
91    pub fn get_no_related_sym(&self) -> Result<isize, MessageRejectErrorEnum> {
92        let mut fld = field::NoRelatedSymField::new(0);
93        self.message.body.get_field(tag::NO_RELATED_SYM, &mut fld.0)?;
94        Ok(fld.value())
95    }
96
97
98    /// Returns true if `NoRelatedSym` is present, Tag 146.
99    pub fn has_no_related_sym(&self) -> bool {
100        self.message.body.has(tag::NO_RELATED_SYM)
101    }
102
103
104
105
106    /// Sets `SecurityReportID`, Tag 964.
107    pub fn set_security_report_id(&mut self, v: isize) {
108        self.message.body.set_field(tag::SECURITY_REPORT_ID, fixer::fix_int::FIXInt::from(v));
109    }
110
111    /// Gets `SecurityReportID`, Tag 964.
112    pub fn get_security_report_id(&self) -> Result<isize, MessageRejectErrorEnum> {
113        let mut fld = field::SecurityReportIDField::new(0);
114        self.message.body.get_field(tag::SECURITY_REPORT_ID, &mut fld.0)?;
115        Ok(fld.value())
116    }
117
118
119    /// Returns true if `SecurityReportID` is present, Tag 964.
120    pub fn has_security_report_id(&self) -> bool {
121        self.message.body.has(tag::SECURITY_REPORT_ID)
122    }
123
124
125
126
127    /// Sets `SecurityReqID`, Tag 320.
128    pub fn set_security_req_id(&mut self, v: String) {
129        self.message.body.set_field(tag::SECURITY_REQ_ID, FIXString::from(v));
130    }
131
132    /// Gets `SecurityReqID`, Tag 320.
133    pub fn get_security_req_id(&self) -> Result<String, MessageRejectErrorEnum> {
134        let mut fld = field::SecurityReqIDField::new(String::new());
135        self.message.body.get_field(tag::SECURITY_REQ_ID, &mut fld.0)?;
136        Ok(fld.value().to_string())
137    }
138
139
140    /// Returns true if `SecurityReqID` is present, Tag 320.
141    pub fn has_security_req_id(&self) -> bool {
142        self.message.body.has(tag::SECURITY_REQ_ID)
143    }
144
145
146
147
148    /// Sets `SecurityRequestResult`, Tag 560.
149    pub fn set_security_request_result(&mut self, v: isize) {
150        self.message.body.set_field(tag::SECURITY_REQUEST_RESULT, fixer::fix_int::FIXInt::from(v));
151    }
152
153    /// Gets `SecurityRequestResult`, Tag 560.
154    pub fn get_security_request_result(&self) -> Result<isize, MessageRejectErrorEnum> {
155        let mut fld = field::SecurityRequestResultField::new(0);
156        self.message.body.get_field(tag::SECURITY_REQUEST_RESULT, &mut fld.0)?;
157        Ok(fld.value())
158    }
159
160
161    /// Returns true if `SecurityRequestResult` is present, Tag 560.
162    pub fn has_security_request_result(&self) -> bool {
163        self.message.body.has(tag::SECURITY_REQUEST_RESULT)
164    }
165
166
167
168
169    /// Sets `SecurityResponseID`, Tag 322.
170    pub fn set_security_response_id(&mut self, v: String) {
171        self.message.body.set_field(tag::SECURITY_RESPONSE_ID, FIXString::from(v));
172    }
173
174    /// Gets `SecurityResponseID`, Tag 322.
175    pub fn get_security_response_id(&self) -> Result<String, MessageRejectErrorEnum> {
176        let mut fld = field::SecurityResponseIDField::new(String::new());
177        self.message.body.get_field(tag::SECURITY_RESPONSE_ID, &mut fld.0)?;
178        Ok(fld.value().to_string())
179    }
180
181
182    /// Returns true if `SecurityResponseID` is present, Tag 322.
183    pub fn has_security_response_id(&self) -> bool {
184        self.message.body.has(tag::SECURITY_RESPONSE_ID)
185    }
186
187
188
189
190    /// Sets `TotNoRelatedSym`, Tag 393.
191    pub fn set_tot_no_related_sym(&mut self, v: isize) {
192        self.message.body.set_field(tag::TOT_NO_RELATED_SYM, fixer::fix_int::FIXInt::from(v));
193    }
194
195    /// Gets `TotNoRelatedSym`, Tag 393.
196    pub fn get_tot_no_related_sym(&self) -> Result<isize, MessageRejectErrorEnum> {
197        let mut fld = field::TotNoRelatedSymField::new(0);
198        self.message.body.get_field(tag::TOT_NO_RELATED_SYM, &mut fld.0)?;
199        Ok(fld.value())
200    }
201
202
203    /// Returns true if `TotNoRelatedSym` is present, Tag 393.
204    pub fn has_tot_no_related_sym(&self) -> bool {
205        self.message.body.has(tag::TOT_NO_RELATED_SYM)
206    }
207
208
209}
210
211/// `RouteOut` is the callback type for routing `SecurityList` messages.
212pub type RouteOut = fn(msg: SecurityList, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
213
214/// Route type returned by the `route` function.
215pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
216
217/// Returns the begin string, message type, and route function for `SecurityList`.
218pub fn route(router: RouteOut) -> Route {
219    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
220        router(SecurityList::from_message(msg.clone()), session_id)
221    };
222    ("7", "y", Box::new(r))
223}