fixer-fix 0.10.1

Generated FIX protocol types for fixer
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
// Code generated by fixer-gen. DO NOT EDIT.
#![allow(clippy::new_without_default)]
#![allow(clippy::needless_pass_by_value)]
#![allow(clippy::too_many_arguments)]
#![allow(unused_imports)]

use fixer::message::Message;
use fixer::fix_string::FIXString;
use fixer::errors::MessageRejectErrorEnum;
use fixer::session::session_id::SessionID;


use jiff::Timestamp;

use crate::field;
use crate::tag;

/// `News` is the `fix50sp1` `News` type, `MsgType` = B.
pub struct News {
    pub message: Message,
}

impl News {
    /// Creates a new `News` with required fields.
    pub fn new(headline: field::HeadlineField, no_lines_of_text: field::NoLinesOfTextField) -> Self {
        let mut msg = Message::new();
        msg.header.set_field(tag::MSG_TYPE, FIXString::from("B".to_string()));

        msg.body.set_field(tag::HEADLINE, headline.0);

        msg.body.set_field(tag::NO_LINES_OF_TEXT, no_lines_of_text.0);

        Self { message: msg }
    }

    /// Creates a `News` from an existing `Message`.
    pub fn from_message(msg: Message) -> Self {
        Self { message: msg }
    }

    /// Returns the underlying `Message`.
    pub fn to_message(self) -> Message {
        self.message
    }




    /// Sets `ApplID`, Tag 1180.
    pub fn set_appl_id(&mut self, v: String) {
        self.message.body.set_field(tag::APPL_ID, FIXString::from(v));
    }

    /// Gets `ApplID`, Tag 1180.
    pub fn get_appl_id(&self) -> Result<String, MessageRejectErrorEnum> {
        let mut fld = field::ApplIDField::new(String::new());
        self.message.body.get_field(tag::APPL_ID, &mut fld.0)?;
        Ok(fld.value().to_string())
    }


    /// Returns true if `ApplID` is present, Tag 1180.
    pub fn has_appl_id(&self) -> bool {
        self.message.body.has(tag::APPL_ID)
    }




    /// Sets `ApplLastSeqNum`, Tag 1350.
    pub fn set_appl_last_seq_num(&mut self, v: isize) {
        self.message.body.set_field(tag::APPL_LAST_SEQ_NUM, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `ApplLastSeqNum`, Tag 1350.
    pub fn get_appl_last_seq_num(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::ApplLastSeqNumField::new(0);
        self.message.body.get_field(tag::APPL_LAST_SEQ_NUM, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `ApplLastSeqNum` is present, Tag 1350.
    pub fn has_appl_last_seq_num(&self) -> bool {
        self.message.body.has(tag::APPL_LAST_SEQ_NUM)
    }




    /// Sets `ApplResendFlag`, Tag 1352.
    pub fn set_appl_resend_flag(&mut self, v: bool) {
        self.message.body.set_field(tag::APPL_RESEND_FLAG, fixer::fix_boolean::FIXBoolean::from(v));
    }

    /// Gets `ApplResendFlag`, Tag 1352.
    pub fn get_appl_resend_flag(&self) -> Result<bool, MessageRejectErrorEnum> {
        let mut fld = field::ApplResendFlagField::new(false);
        self.message.body.get_field(tag::APPL_RESEND_FLAG, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `ApplResendFlag` is present, Tag 1352.
    pub fn has_appl_resend_flag(&self) -> bool {
        self.message.body.has(tag::APPL_RESEND_FLAG)
    }




    /// Sets `ApplSeqNum`, Tag 1181.
    pub fn set_appl_seq_num(&mut self, v: isize) {
        self.message.body.set_field(tag::APPL_SEQ_NUM, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `ApplSeqNum`, Tag 1181.
    pub fn get_appl_seq_num(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::ApplSeqNumField::new(0);
        self.message.body.get_field(tag::APPL_SEQ_NUM, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `ApplSeqNum` is present, Tag 1181.
    pub fn has_appl_seq_num(&self) -> bool {
        self.message.body.has(tag::APPL_SEQ_NUM)
    }




    /// Sets `EncodedHeadline`, Tag 359.
    pub fn set_encoded_headline(&mut self, v: String) {
        self.message.body.set_field(tag::ENCODED_HEADLINE, FIXString::from(v));
    }

    /// Gets `EncodedHeadline`, Tag 359.
    pub fn get_encoded_headline(&self) -> Result<String, MessageRejectErrorEnum> {
        let mut fld = field::EncodedHeadlineField::new(String::new());
        self.message.body.get_field(tag::ENCODED_HEADLINE, &mut fld.0)?;
        Ok(fld.value().to_string())
    }


    /// Returns true if `EncodedHeadline` is present, Tag 359.
    pub fn has_encoded_headline(&self) -> bool {
        self.message.body.has(tag::ENCODED_HEADLINE)
    }




    /// Sets `EncodedHeadlineLen`, Tag 358.
    pub fn set_encoded_headline_len(&mut self, v: isize) {
        self.message.body.set_field(tag::ENCODED_HEADLINE_LEN, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `EncodedHeadlineLen`, Tag 358.
    pub fn get_encoded_headline_len(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::EncodedHeadlineLenField::new(0);
        self.message.body.get_field(tag::ENCODED_HEADLINE_LEN, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `EncodedHeadlineLen` is present, Tag 358.
    pub fn has_encoded_headline_len(&self) -> bool {
        self.message.body.has(tag::ENCODED_HEADLINE_LEN)
    }




    /// Sets `Headline`, Tag 148.
    pub fn set_headline(&mut self, v: String) {
        self.message.body.set_field(tag::HEADLINE, FIXString::from(v));
    }

    /// Gets `Headline`, Tag 148.
    pub fn get_headline(&self) -> Result<String, MessageRejectErrorEnum> {
        let mut fld = field::HeadlineField::new(String::new());
        self.message.body.get_field(tag::HEADLINE, &mut fld.0)?;
        Ok(fld.value().to_string())
    }


    /// Returns true if `Headline` is present, Tag 148.
    pub fn has_headline(&self) -> bool {
        self.message.body.has(tag::HEADLINE)
    }




    /// Sets `NoLegs`, Tag 555.
    pub fn set_no_legs(&mut self, v: isize) {
        self.message.body.set_field(tag::NO_LEGS, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `NoLegs`, Tag 555.
    pub fn get_no_legs(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::NoLegsField::new(0);
        self.message.body.get_field(tag::NO_LEGS, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `NoLegs` is present, Tag 555.
    pub fn has_no_legs(&self) -> bool {
        self.message.body.has(tag::NO_LEGS)
    }




    /// Sets `NoLinesOfText`, Tag 33.
    pub fn set_no_lines_of_text(&mut self, v: isize) {
        self.message.body.set_field(tag::NO_LINES_OF_TEXT, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `NoLinesOfText`, Tag 33.
    pub fn get_no_lines_of_text(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::NoLinesOfTextField::new(0);
        self.message.body.get_field(tag::NO_LINES_OF_TEXT, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `NoLinesOfText` is present, Tag 33.
    pub fn has_no_lines_of_text(&self) -> bool {
        self.message.body.has(tag::NO_LINES_OF_TEXT)
    }




    /// Sets `NoRelatedSym`, Tag 146.
    pub fn set_no_related_sym(&mut self, v: isize) {
        self.message.body.set_field(tag::NO_RELATED_SYM, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `NoRelatedSym`, Tag 146.
    pub fn get_no_related_sym(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::NoRelatedSymField::new(0);
        self.message.body.get_field(tag::NO_RELATED_SYM, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `NoRelatedSym` is present, Tag 146.
    pub fn has_no_related_sym(&self) -> bool {
        self.message.body.has(tag::NO_RELATED_SYM)
    }




    /// Sets `NoRoutingIDs`, Tag 215.
    pub fn set_no_routing_i_ds(&mut self, v: isize) {
        self.message.body.set_field(tag::NO_ROUTING_I_DS, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `NoRoutingIDs`, Tag 215.
    pub fn get_no_routing_i_ds(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::NoRoutingIDsField::new(0);
        self.message.body.get_field(tag::NO_ROUTING_I_DS, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `NoRoutingIDs` is present, Tag 215.
    pub fn has_no_routing_i_ds(&self) -> bool {
        self.message.body.has(tag::NO_ROUTING_I_DS)
    }




    /// Sets `NoUnderlyings`, Tag 711.
    pub fn set_no_underlyings(&mut self, v: isize) {
        self.message.body.set_field(tag::NO_UNDERLYINGS, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `NoUnderlyings`, Tag 711.
    pub fn get_no_underlyings(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::NoUnderlyingsField::new(0);
        self.message.body.get_field(tag::NO_UNDERLYINGS, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `NoUnderlyings` is present, Tag 711.
    pub fn has_no_underlyings(&self) -> bool {
        self.message.body.has(tag::NO_UNDERLYINGS)
    }




    /// Sets `OrigTime`, Tag 42.
    pub fn set_orig_time(&mut self, v: Timestamp) {
        self.message.body.set_field(tag::ORIG_TIME, fixer::fix_utc_timestamp::FIXUTCTimestamp {
            time: v,
            precision: fixer::fix_utc_timestamp::TimestampPrecision::Millis,
        });
    }

    /// Gets `OrigTime`, Tag 42.
    pub fn get_orig_time(&self) -> Result<Timestamp, MessageRejectErrorEnum> {
        let mut fld = field::OrigTimeField::new(Timestamp::UNIX_EPOCH);
        self.message.body.get_field(tag::ORIG_TIME, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `OrigTime` is present, Tag 42.
    pub fn has_orig_time(&self) -> bool {
        self.message.body.has(tag::ORIG_TIME)
    }




    /// Sets `RawData`, Tag 96.
    pub fn set_raw_data(&mut self, v: String) {
        self.message.body.set_field(tag::RAW_DATA, FIXString::from(v));
    }

    /// Gets `RawData`, Tag 96.
    pub fn get_raw_data(&self) -> Result<String, MessageRejectErrorEnum> {
        let mut fld = field::RawDataField::new(String::new());
        self.message.body.get_field(tag::RAW_DATA, &mut fld.0)?;
        Ok(fld.value().to_string())
    }


    /// Returns true if `RawData` is present, Tag 96.
    pub fn has_raw_data(&self) -> bool {
        self.message.body.has(tag::RAW_DATA)
    }




    /// Sets `RawDataLength`, Tag 95.
    pub fn set_raw_data_length(&mut self, v: isize) {
        self.message.body.set_field(tag::RAW_DATA_LENGTH, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `RawDataLength`, Tag 95.
    pub fn get_raw_data_length(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::RawDataLengthField::new(0);
        self.message.body.get_field(tag::RAW_DATA_LENGTH, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `RawDataLength` is present, Tag 95.
    pub fn has_raw_data_length(&self) -> bool {
        self.message.body.has(tag::RAW_DATA_LENGTH)
    }




    /// Sets `URLLink`, Tag 149.
    pub fn set_url_link(&mut self, v: String) {
        self.message.body.set_field(tag::URL_LINK, FIXString::from(v));
    }

    /// Gets `URLLink`, Tag 149.
    pub fn get_url_link(&self) -> Result<String, MessageRejectErrorEnum> {
        let mut fld = field::URLLinkField::new(String::new());
        self.message.body.get_field(tag::URL_LINK, &mut fld.0)?;
        Ok(fld.value().to_string())
    }


    /// Returns true if `URLLink` is present, Tag 149.
    pub fn has_url_link(&self) -> bool {
        self.message.body.has(tag::URL_LINK)
    }




    /// Sets `Urgency`, Tag 61.
    pub fn set_urgency(&mut self, v: String) {
        self.message.body.set_field(tag::URGENCY, FIXString::from(v));
    }

    /// Gets `Urgency`, Tag 61.
    pub fn get_urgency(&self) -> Result<String, MessageRejectErrorEnum> {
        let mut fld = field::UrgencyField::new(String::new());
        self.message.body.get_field(tag::URGENCY, &mut fld.0)?;
        Ok(fld.value().to_string())
    }


    /// Returns true if `Urgency` is present, Tag 61.
    pub fn has_urgency(&self) -> bool {
        self.message.body.has(tag::URGENCY)
    }


}

/// `RouteOut` is the callback type for routing `News` messages.
pub type RouteOut = fn(msg: News, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;

/// Route type returned by the `route` function.
pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);

/// Returns the begin string, message type, and route function for `News`.
pub fn route(router: RouteOut) -> Route {
    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
        router(News::from_message(msg.clone()), session_id)
    };
    ("8", "B", Box::new(r))
}