fixer-fix 0.10.1

Generated FIX protocol types for fixer
Documentation
// 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 crate::field;
use crate::tag;

/// `MarketDataIncrementalRefresh` is the `fix44` `MarketDataIncrementalRefresh` type, `MsgType` = X.
pub struct MarketDataIncrementalRefresh {
    pub message: Message,
}

impl MarketDataIncrementalRefresh {
    /// Creates a new `MarketDataIncrementalRefresh` with required fields.
    pub fn new(no_md_entries: field::NoMDEntriesField) -> Self {
        let mut msg = Message::new();
        msg.header.set_field(tag::MSG_TYPE, FIXString::from("X".to_string()));

        msg.body.set_field(tag::NO_MD_ENTRIES, no_md_entries.0);

        Self { message: msg }
    }

    /// Creates a `MarketDataIncrementalRefresh` 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 `ApplQueueDepth`, Tag 813.
    pub fn set_appl_queue_depth(&mut self, v: isize) {
        self.message.body.set_field(tag::APPL_QUEUE_DEPTH, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `ApplQueueDepth`, Tag 813.
    pub fn get_appl_queue_depth(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::ApplQueueDepthField::new(0);
        self.message.body.get_field(tag::APPL_QUEUE_DEPTH, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `ApplQueueDepth` is present, Tag 813.
    pub fn has_appl_queue_depth(&self) -> bool {
        self.message.body.has(tag::APPL_QUEUE_DEPTH)
    }




    /// Sets `ApplQueueResolution`, Tag 814.
    pub fn set_appl_queue_resolution(&mut self, v: isize) {
        self.message.body.set_field(tag::APPL_QUEUE_RESOLUTION, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `ApplQueueResolution`, Tag 814.
    pub fn get_appl_queue_resolution(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::ApplQueueResolutionField::new(0);
        self.message.body.get_field(tag::APPL_QUEUE_RESOLUTION, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `ApplQueueResolution` is present, Tag 814.
    pub fn has_appl_queue_resolution(&self) -> bool {
        self.message.body.has(tag::APPL_QUEUE_RESOLUTION)
    }




    /// Sets `MDReqID`, Tag 262.
    pub fn set_md_req_id(&mut self, v: String) {
        self.message.body.set_field(tag::MD_REQ_ID, FIXString::from(v));
    }

    /// Gets `MDReqID`, Tag 262.
    pub fn get_md_req_id(&self) -> Result<String, MessageRejectErrorEnum> {
        let mut fld = field::MDReqIDField::new(String::new());
        self.message.body.get_field(tag::MD_REQ_ID, &mut fld.0)?;
        Ok(fld.value().to_string())
    }


    /// Returns true if `MDReqID` is present, Tag 262.
    pub fn has_md_req_id(&self) -> bool {
        self.message.body.has(tag::MD_REQ_ID)
    }




    /// Sets `NoMDEntries`, Tag 268.
    pub fn set_no_md_entries(&mut self, v: isize) {
        self.message.body.set_field(tag::NO_MD_ENTRIES, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `NoMDEntries`, Tag 268.
    pub fn get_no_md_entries(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::NoMDEntriesField::new(0);
        self.message.body.get_field(tag::NO_MD_ENTRIES, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `NoMDEntries` is present, Tag 268.
    pub fn has_no_md_entries(&self) -> bool {
        self.message.body.has(tag::NO_MD_ENTRIES)
    }


}

/// `RouteOut` is the callback type for routing `MarketDataIncrementalRefresh` messages.
pub type RouteOut = fn(msg: MarketDataIncrementalRefresh, 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 `MarketDataIncrementalRefresh`.
pub fn route(router: RouteOut) -> Route {
    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
        router(MarketDataIncrementalRefresh::from_message(msg.clone()), session_id)
    };
    ("FIX.4.4", "X", Box::new(r))
}