Skip to main content

fixer_fix/fix50sp2/
stream_assignment_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/// `StreamAssignmentRequest` is the `fix50sp2` `StreamAssignmentRequest` type, `MsgType` = CC.
17pub struct StreamAssignmentRequest {
18    pub message: Message,
19}
20
21impl StreamAssignmentRequest {
22    /// Creates a new `StreamAssignmentRequest` with required fields.
23    pub fn new(stream_asgn_req_id: field::StreamAsgnReqIDField, stream_asgn_req_type: field::StreamAsgnReqTypeField) -> Self {
24        let mut msg = Message::new();
25        msg.header.set_field(tag::MSG_TYPE, FIXString::from("CC".to_string()));
26
27        msg.body.set_field(tag::STREAM_ASGN_REQ_ID, stream_asgn_req_id.0);
28
29        msg.body.set_field(tag::STREAM_ASGN_REQ_TYPE, stream_asgn_req_type.0);
30
31        Self { message: msg }
32    }
33
34    /// Creates a `StreamAssignmentRequest` from an existing `Message`.
35    pub fn from_message(msg: Message) -> Self {
36        Self { message: msg }
37    }
38
39    /// Returns the underlying `Message`.
40    pub fn to_message(self) -> Message {
41        self.message
42    }
43
44
45
46
47    /// Sets `NoAsgnReqs`, Tag 1499.
48    pub fn set_no_asgn_reqs(&mut self, v: isize) {
49        self.message.body.set_field(tag::NO_ASGN_REQS, fixer::fix_int::FIXInt::from(v));
50    }
51
52    /// Gets `NoAsgnReqs`, Tag 1499.
53    pub fn get_no_asgn_reqs(&self) -> Result<isize, MessageRejectErrorEnum> {
54        let mut fld = field::NoAsgnReqsField::new(0);
55        self.message.body.get_field(tag::NO_ASGN_REQS, &mut fld.0)?;
56        Ok(fld.value())
57    }
58
59
60    /// Returns true if `NoAsgnReqs` is present, Tag 1499.
61    pub fn has_no_asgn_reqs(&self) -> bool {
62        self.message.body.has(tag::NO_ASGN_REQS)
63    }
64
65
66
67
68    /// Sets `StreamAsgnReqID`, Tag 1497.
69    pub fn set_stream_asgn_req_id(&mut self, v: String) {
70        self.message.body.set_field(tag::STREAM_ASGN_REQ_ID, FIXString::from(v));
71    }
72
73    /// Gets `StreamAsgnReqID`, Tag 1497.
74    pub fn get_stream_asgn_req_id(&self) -> Result<String, MessageRejectErrorEnum> {
75        let mut fld = field::StreamAsgnReqIDField::new(String::new());
76        self.message.body.get_field(tag::STREAM_ASGN_REQ_ID, &mut fld.0)?;
77        Ok(fld.value().to_string())
78    }
79
80
81    /// Returns true if `StreamAsgnReqID` is present, Tag 1497.
82    pub fn has_stream_asgn_req_id(&self) -> bool {
83        self.message.body.has(tag::STREAM_ASGN_REQ_ID)
84    }
85
86
87
88
89    /// Sets `StreamAsgnReqType`, Tag 1498.
90    pub fn set_stream_asgn_req_type(&mut self, v: isize) {
91        self.message.body.set_field(tag::STREAM_ASGN_REQ_TYPE, fixer::fix_int::FIXInt::from(v));
92    }
93
94    /// Gets `StreamAsgnReqType`, Tag 1498.
95    pub fn get_stream_asgn_req_type(&self) -> Result<isize, MessageRejectErrorEnum> {
96        let mut fld = field::StreamAsgnReqTypeField::new(0);
97        self.message.body.get_field(tag::STREAM_ASGN_REQ_TYPE, &mut fld.0)?;
98        Ok(fld.value())
99    }
100
101
102    /// Returns true if `StreamAsgnReqType` is present, Tag 1498.
103    pub fn has_stream_asgn_req_type(&self) -> bool {
104        self.message.body.has(tag::STREAM_ASGN_REQ_TYPE)
105    }
106
107
108}
109
110/// `RouteOut` is the callback type for routing `StreamAssignmentRequest` messages.
111pub type RouteOut = fn(msg: StreamAssignmentRequest, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
112
113/// Route type returned by the `route` function.
114pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
115
116/// Returns the begin string, message type, and route function for `StreamAssignmentRequest`.
117pub fn route(router: RouteOut) -> Route {
118    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
119        router(StreamAssignmentRequest::from_message(msg.clone()), session_id)
120    };
121    ("9", "CC", Box::new(r))
122}