Skip to main content

fixer_fix/fix44/
market_data_incremental_refresh.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/// `MarketDataIncrementalRefresh` is the `fix44` `MarketDataIncrementalRefresh` type, `MsgType` = X.
17pub struct MarketDataIncrementalRefresh {
18    pub message: Message,
19}
20
21impl MarketDataIncrementalRefresh {
22    /// Creates a new `MarketDataIncrementalRefresh` with required fields.
23    pub fn new(no_md_entries: field::NoMDEntriesField) -> Self {
24        let mut msg = Message::new();
25        msg.header.set_field(tag::MSG_TYPE, FIXString::from("X".to_string()));
26
27        msg.body.set_field(tag::NO_MD_ENTRIES, no_md_entries.0);
28
29        Self { message: msg }
30    }
31
32    /// Creates a `MarketDataIncrementalRefresh` 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 `ApplQueueDepth`, Tag 813.
46    pub fn set_appl_queue_depth(&mut self, v: isize) {
47        self.message.body.set_field(tag::APPL_QUEUE_DEPTH, fixer::fix_int::FIXInt::from(v));
48    }
49
50    /// Gets `ApplQueueDepth`, Tag 813.
51    pub fn get_appl_queue_depth(&self) -> Result<isize, MessageRejectErrorEnum> {
52        let mut fld = field::ApplQueueDepthField::new(0);
53        self.message.body.get_field(tag::APPL_QUEUE_DEPTH, &mut fld.0)?;
54        Ok(fld.value())
55    }
56
57
58    /// Returns true if `ApplQueueDepth` is present, Tag 813.
59    pub fn has_appl_queue_depth(&self) -> bool {
60        self.message.body.has(tag::APPL_QUEUE_DEPTH)
61    }
62
63
64
65
66    /// Sets `ApplQueueResolution`, Tag 814.
67    pub fn set_appl_queue_resolution(&mut self, v: isize) {
68        self.message.body.set_field(tag::APPL_QUEUE_RESOLUTION, fixer::fix_int::FIXInt::from(v));
69    }
70
71    /// Gets `ApplQueueResolution`, Tag 814.
72    pub fn get_appl_queue_resolution(&self) -> Result<isize, MessageRejectErrorEnum> {
73        let mut fld = field::ApplQueueResolutionField::new(0);
74        self.message.body.get_field(tag::APPL_QUEUE_RESOLUTION, &mut fld.0)?;
75        Ok(fld.value())
76    }
77
78
79    /// Returns true if `ApplQueueResolution` is present, Tag 814.
80    pub fn has_appl_queue_resolution(&self) -> bool {
81        self.message.body.has(tag::APPL_QUEUE_RESOLUTION)
82    }
83
84
85
86
87    /// Sets `MDReqID`, Tag 262.
88    pub fn set_md_req_id(&mut self, v: String) {
89        self.message.body.set_field(tag::MD_REQ_ID, FIXString::from(v));
90    }
91
92    /// Gets `MDReqID`, Tag 262.
93    pub fn get_md_req_id(&self) -> Result<String, MessageRejectErrorEnum> {
94        let mut fld = field::MDReqIDField::new(String::new());
95        self.message.body.get_field(tag::MD_REQ_ID, &mut fld.0)?;
96        Ok(fld.value().to_string())
97    }
98
99
100    /// Returns true if `MDReqID` is present, Tag 262.
101    pub fn has_md_req_id(&self) -> bool {
102        self.message.body.has(tag::MD_REQ_ID)
103    }
104
105
106
107
108    /// Sets `NoMDEntries`, Tag 268.
109    pub fn set_no_md_entries(&mut self, v: isize) {
110        self.message.body.set_field(tag::NO_MD_ENTRIES, fixer::fix_int::FIXInt::from(v));
111    }
112
113    /// Gets `NoMDEntries`, Tag 268.
114    pub fn get_no_md_entries(&self) -> Result<isize, MessageRejectErrorEnum> {
115        let mut fld = field::NoMDEntriesField::new(0);
116        self.message.body.get_field(tag::NO_MD_ENTRIES, &mut fld.0)?;
117        Ok(fld.value())
118    }
119
120
121    /// Returns true if `NoMDEntries` is present, Tag 268.
122    pub fn has_no_md_entries(&self) -> bool {
123        self.message.body.has(tag::NO_MD_ENTRIES)
124    }
125
126
127}
128
129/// `RouteOut` is the callback type for routing `MarketDataIncrementalRefresh` messages.
130pub type RouteOut = fn(msg: MarketDataIncrementalRefresh, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
131
132/// Route type returned by the `route` function.
133pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
134
135/// Returns the begin string, message type, and route function for `MarketDataIncrementalRefresh`.
136pub fn route(router: RouteOut) -> Route {
137    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
138        router(MarketDataIncrementalRefresh::from_message(msg.clone()), session_id)
139    };
140    ("FIX.4.4", "X", Box::new(r))
141}