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 jiff::Timestamp;

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

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

impl ListStatus {
    /// Creates a new `ListStatus` with required fields.
    pub fn new(list_id: field::ListIDField, list_status_type: field::ListStatusTypeField, no_rpts: field::NoRptsField, list_order_status: field::ListOrderStatusField, rpt_seq: field::RptSeqField, tot_no_orders: field::TotNoOrdersField, no_orders: field::NoOrdersField) -> Self {
        let mut msg = Message::new();
        msg.header.set_field(tag::MSG_TYPE, FIXString::from("N".to_string()));

        msg.body.set_field(tag::LIST_ID, list_id.0);

        msg.body.set_field(tag::LIST_STATUS_TYPE, list_status_type.0);

        msg.body.set_field(tag::NO_RPTS, no_rpts.0);

        msg.body.set_field(tag::LIST_ORDER_STATUS, list_order_status.0);

        msg.body.set_field(tag::RPT_SEQ, rpt_seq.0);

        msg.body.set_field(tag::TOT_NO_ORDERS, tot_no_orders.0);

        msg.body.set_field(tag::NO_ORDERS, no_orders.0);

        Self { message: msg }
    }

    /// Creates a `ListStatus` 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 `EncodedListStatusText`, Tag 446.
    pub fn set_encoded_list_status_text(&mut self, v: String) {
        self.message.body.set_field(tag::ENCODED_LIST_STATUS_TEXT, FIXString::from(v));
    }

    /// Gets `EncodedListStatusText`, Tag 446.
    pub fn get_encoded_list_status_text(&self) -> Result<String, MessageRejectErrorEnum> {
        let mut fld = field::EncodedListStatusTextField::new(String::new());
        self.message.body.get_field(tag::ENCODED_LIST_STATUS_TEXT, &mut fld.0)?;
        Ok(fld.value().to_string())
    }


    /// Returns true if `EncodedListStatusText` is present, Tag 446.
    pub fn has_encoded_list_status_text(&self) -> bool {
        self.message.body.has(tag::ENCODED_LIST_STATUS_TEXT)
    }




    /// Sets `EncodedListStatusTextLen`, Tag 445.
    pub fn set_encoded_list_status_text_len(&mut self, v: isize) {
        self.message.body.set_field(tag::ENCODED_LIST_STATUS_TEXT_LEN, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `EncodedListStatusTextLen`, Tag 445.
    pub fn get_encoded_list_status_text_len(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::EncodedListStatusTextLenField::new(0);
        self.message.body.get_field(tag::ENCODED_LIST_STATUS_TEXT_LEN, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `EncodedListStatusTextLen` is present, Tag 445.
    pub fn has_encoded_list_status_text_len(&self) -> bool {
        self.message.body.has(tag::ENCODED_LIST_STATUS_TEXT_LEN)
    }




    /// Sets `LastFragment`, Tag 893.
    pub fn set_last_fragment(&mut self, v: bool) {
        self.message.body.set_field(tag::LAST_FRAGMENT, fixer::fix_boolean::FIXBoolean::from(v));
    }

    /// Gets `LastFragment`, Tag 893.
    pub fn get_last_fragment(&self) -> Result<bool, MessageRejectErrorEnum> {
        let mut fld = field::LastFragmentField::new(false);
        self.message.body.get_field(tag::LAST_FRAGMENT, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `LastFragment` is present, Tag 893.
    pub fn has_last_fragment(&self) -> bool {
        self.message.body.has(tag::LAST_FRAGMENT)
    }




    /// Sets `ListID`, Tag 66.
    pub fn set_list_id(&mut self, v: String) {
        self.message.body.set_field(tag::LIST_ID, FIXString::from(v));
    }

    /// Gets `ListID`, Tag 66.
    pub fn get_list_id(&self) -> Result<String, MessageRejectErrorEnum> {
        let mut fld = field::ListIDField::new(String::new());
        self.message.body.get_field(tag::LIST_ID, &mut fld.0)?;
        Ok(fld.value().to_string())
    }


    /// Returns true if `ListID` is present, Tag 66.
    pub fn has_list_id(&self) -> bool {
        self.message.body.has(tag::LIST_ID)
    }




    /// Sets `ListOrderStatus`, Tag 431.
    pub fn set_list_order_status(&mut self, v: isize) {
        self.message.body.set_field(tag::LIST_ORDER_STATUS, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `ListOrderStatus`, Tag 431.
    pub fn get_list_order_status(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::ListOrderStatusField::new(0);
        self.message.body.get_field(tag::LIST_ORDER_STATUS, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `ListOrderStatus` is present, Tag 431.
    pub fn has_list_order_status(&self) -> bool {
        self.message.body.has(tag::LIST_ORDER_STATUS)
    }




    /// Sets `ListStatusText`, Tag 444.
    pub fn set_list_status_text(&mut self, v: String) {
        self.message.body.set_field(tag::LIST_STATUS_TEXT, FIXString::from(v));
    }

    /// Gets `ListStatusText`, Tag 444.
    pub fn get_list_status_text(&self) -> Result<String, MessageRejectErrorEnum> {
        let mut fld = field::ListStatusTextField::new(String::new());
        self.message.body.get_field(tag::LIST_STATUS_TEXT, &mut fld.0)?;
        Ok(fld.value().to_string())
    }


    /// Returns true if `ListStatusText` is present, Tag 444.
    pub fn has_list_status_text(&self) -> bool {
        self.message.body.has(tag::LIST_STATUS_TEXT)
    }




    /// Sets `ListStatusType`, Tag 429.
    pub fn set_list_status_type(&mut self, v: isize) {
        self.message.body.set_field(tag::LIST_STATUS_TYPE, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `ListStatusType`, Tag 429.
    pub fn get_list_status_type(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::ListStatusTypeField::new(0);
        self.message.body.get_field(tag::LIST_STATUS_TYPE, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `ListStatusType` is present, Tag 429.
    pub fn has_list_status_type(&self) -> bool {
        self.message.body.has(tag::LIST_STATUS_TYPE)
    }




    /// Sets `NoOrders`, Tag 73.
    pub fn set_no_orders(&mut self, v: isize) {
        self.message.body.set_field(tag::NO_ORDERS, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `NoOrders`, Tag 73.
    pub fn get_no_orders(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::NoOrdersField::new(0);
        self.message.body.get_field(tag::NO_ORDERS, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `NoOrders` is present, Tag 73.
    pub fn has_no_orders(&self) -> bool {
        self.message.body.has(tag::NO_ORDERS)
    }




    /// Sets `NoRpts`, Tag 82.
    pub fn set_no_rpts(&mut self, v: isize) {
        self.message.body.set_field(tag::NO_RPTS, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `NoRpts`, Tag 82.
    pub fn get_no_rpts(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::NoRptsField::new(0);
        self.message.body.get_field(tag::NO_RPTS, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `NoRpts` is present, Tag 82.
    pub fn has_no_rpts(&self) -> bool {
        self.message.body.has(tag::NO_RPTS)
    }




    /// Sets `RptSeq`, Tag 83.
    pub fn set_rpt_seq(&mut self, v: isize) {
        self.message.body.set_field(tag::RPT_SEQ, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `RptSeq`, Tag 83.
    pub fn get_rpt_seq(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::RptSeqField::new(0);
        self.message.body.get_field(tag::RPT_SEQ, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `RptSeq` is present, Tag 83.
    pub fn has_rpt_seq(&self) -> bool {
        self.message.body.has(tag::RPT_SEQ)
    }




    /// Sets `TotNoOrders`, Tag 68.
    pub fn set_tot_no_orders(&mut self, v: isize) {
        self.message.body.set_field(tag::TOT_NO_ORDERS, fixer::fix_int::FIXInt::from(v));
    }

    /// Gets `TotNoOrders`, Tag 68.
    pub fn get_tot_no_orders(&self) -> Result<isize, MessageRejectErrorEnum> {
        let mut fld = field::TotNoOrdersField::new(0);
        self.message.body.get_field(tag::TOT_NO_ORDERS, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `TotNoOrders` is present, Tag 68.
    pub fn has_tot_no_orders(&self) -> bool {
        self.message.body.has(tag::TOT_NO_ORDERS)
    }




    /// Sets `TransactTime`, Tag 60.
    pub fn set_transact_time(&mut self, v: Timestamp) {
        self.message.body.set_field(tag::TRANSACT_TIME, fixer::fix_utc_timestamp::FIXUTCTimestamp {
            time: v,
            precision: fixer::fix_utc_timestamp::TimestampPrecision::Millis,
        });
    }

    /// Gets `TransactTime`, Tag 60.
    pub fn get_transact_time(&self) -> Result<Timestamp, MessageRejectErrorEnum> {
        let mut fld = field::TransactTimeField::new(Timestamp::UNIX_EPOCH);
        self.message.body.get_field(tag::TRANSACT_TIME, &mut fld.0)?;
        Ok(fld.value())
    }


    /// Returns true if `TransactTime` is present, Tag 60.
    pub fn has_transact_time(&self) -> bool {
        self.message.body.has(tag::TRANSACT_TIME)
    }


}

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