Skip to main content

fixer_fix/fix41/
list_status_request.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/// `ListStatusRequest` is the `fix41` `ListStatusRequest` type, `MsgType` = M.
17pub struct ListStatusRequest {
18    pub message: Message,
19}
20
21impl ListStatusRequest {
22    /// Creates a new `ListStatusRequest` with required fields.
23    pub fn new(list_id: field::ListIDField) -> Self {
24        let mut msg = Message::new();
25        msg.header.set_field(tag::MSG_TYPE, FIXString::from("M".to_string()));
26
27        msg.body.set_field(tag::LIST_ID, list_id.0);
28
29        Self { message: msg }
30    }
31
32    /// Creates a `ListStatusRequest` 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 `ListID`, Tag 66.
46    pub fn set_list_id(&mut self, v: String) {
47        self.message.body.set_field(tag::LIST_ID, FIXString::from(v));
48    }
49
50    /// Gets `ListID`, Tag 66.
51    pub fn get_list_id(&self) -> Result<String, MessageRejectErrorEnum> {
52        let mut fld = field::ListIDField::new(String::new());
53        self.message.body.get_field(tag::LIST_ID, &mut fld.0)?;
54        Ok(fld.value().to_string())
55    }
56
57
58    /// Returns true if `ListID` is present, Tag 66.
59    pub fn has_list_id(&self) -> bool {
60        self.message.body.has(tag::LIST_ID)
61    }
62
63
64
65
66    /// Sets `Text`, Tag 58.
67    pub fn set_text(&mut self, v: String) {
68        self.message.body.set_field(tag::TEXT, FIXString::from(v));
69    }
70
71    /// Gets `Text`, Tag 58.
72    pub fn get_text(&self) -> Result<String, MessageRejectErrorEnum> {
73        let mut fld = field::TextField::new(String::new());
74        self.message.body.get_field(tag::TEXT, &mut fld.0)?;
75        Ok(fld.value().to_string())
76    }
77
78
79    /// Returns true if `Text` is present, Tag 58.
80    pub fn has_text(&self) -> bool {
81        self.message.body.has(tag::TEXT)
82    }
83
84
85
86
87    /// Sets `WaveNo`, Tag 105.
88    pub fn set_wave_no(&mut self, v: String) {
89        self.message.body.set_field(tag::WAVE_NO, FIXString::from(v));
90    }
91
92    /// Gets `WaveNo`, Tag 105.
93    pub fn get_wave_no(&self) -> Result<String, MessageRejectErrorEnum> {
94        let mut fld = field::WaveNoField::new(String::new());
95        self.message.body.get_field(tag::WAVE_NO, &mut fld.0)?;
96        Ok(fld.value().to_string())
97    }
98
99
100    /// Returns true if `WaveNo` is present, Tag 105.
101    pub fn has_wave_no(&self) -> bool {
102        self.message.body.has(tag::WAVE_NO)
103    }
104
105
106}
107
108/// `RouteOut` is the callback type for routing `ListStatusRequest` messages.
109pub type RouteOut = fn(msg: ListStatusRequest, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
110
111/// Route type returned by the `route` function.
112pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
113
114/// Returns the begin string, message type, and route function for `ListStatusRequest`.
115pub fn route(router: RouteOut) -> Route {
116    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
117        router(ListStatusRequest::from_message(msg.clone()), session_id)
118    };
119    ("FIX.4.1", "M", Box::new(r))
120}