refix-fix42 0.4.0

Typed FIX 4.2 protocol messages for the ReFIX engine
Documentation
// @generated by refix codegen from FIX42.xml. Do not edit.
#![cfg_attr(rustfmt, rustfmt::skip)]

use refix_message::{Date, InvalidValue, RawMessage, Tag, UtcTimestamp};

use super::super::components::{Header, Trailer};
use super::super::enums::{
    SecurityType, SettlInstMode, SettlInstSource, SettlInstTransType, SettlLocation, Side,
    StandInstDbType,
};

/// The `SettlementInstructions` (35=T) message.
pub struct SettlementInstructions(RawMessage);

impl SettlementInstructions {
    pub const MSG_TYPE: &[u8] = b"T";

    pub fn from_raw(raw: RawMessage) -> Self {
        Self(raw)
    }

    pub fn raw(&self) -> &RawMessage {
        &self.0
    }

    pub fn header(&self) -> Header<'_> {
        Header(self.0.scope())
    }

    pub fn trailer(&self) -> Trailer<'_> {
        Trailer(self.0.scope())
    }

    /// The `SettlInstID` (162) field.
    #[doc(alias = "SettlInstID")]
    pub fn settl_inst_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(162))
    }

    /// The `SettlInstTransType` (163) field.
    #[doc(alias = "SettlInstTransType")]
    pub fn settl_inst_trans_type(&self) -> Result<Option<SettlInstTransType<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(163))?.map(SettlInstTransType::from_value))
    }

    /// The `SettlInstRefID` (214) field.
    #[doc(alias = "SettlInstRefID")]
    pub fn settl_inst_ref_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(214))
    }

    /// The `SettlInstMode` (160) field.
    #[doc(alias = "SettlInstMode")]
    pub fn settl_inst_mode(&self) -> Result<Option<SettlInstMode<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(160))?.map(SettlInstMode::from_value))
    }

    /// The `SettlInstSource` (165) field.
    #[doc(alias = "SettlInstSource")]
    pub fn settl_inst_source(&self) -> Result<Option<SettlInstSource<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(165))?.map(SettlInstSource::from_value))
    }

    /// The `AllocAccount` (79) field.
    #[doc(alias = "AllocAccount")]
    pub fn alloc_account(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(79))
    }

    /// The `SettlLocation` (166) field.
    #[doc(alias = "SettlLocation")]
    pub fn settl_location(&self) -> Result<Option<SettlLocation<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(166))?.map(SettlLocation::from_value))
    }

    /// The `TradeDate` (75) field.
    #[doc(alias = "TradeDate")]
    pub fn trade_date(&self) -> Result<Option<Date>, InvalidValue> {
        self.0.get_date(Tag(75))
    }

    /// The `AllocID` (70) field.
    #[doc(alias = "AllocID")]
    pub fn alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(70))
    }

    /// The `LastMkt` (30) field.
    #[doc(alias = "LastMkt")]
    pub fn last_mkt(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(30))
    }

    /// The `TradingSessionID` (336) field.
    #[doc(alias = "TradingSessionID")]
    pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(336))
    }

    /// The `Side` (54) field.
    #[doc(alias = "Side")]
    pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
    }

    /// The `SecurityType` (167) field.
    #[doc(alias = "SecurityType")]
    pub fn security_type(&self) -> Result<Option<SecurityType<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(167))?.map(SecurityType::from_value))
    }

    /// The `EffectiveTime` (168) field.
    #[doc(alias = "EffectiveTime")]
    pub fn effective_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
        self.0.get_utc_timestamp(Tag(168))
    }

    /// The `TransactTime` (60) field.
    #[doc(alias = "TransactTime")]
    pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
        self.0.get_utc_timestamp(Tag(60))
    }

    /// The `ClientID` (109) field.
    #[doc(alias = "ClientID")]
    pub fn client_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(109))
    }

    /// The `ExecBroker` (76) field.
    #[doc(alias = "ExecBroker")]
    pub fn exec_broker(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(76))
    }

    /// The `StandInstDbType` (169) field.
    #[doc(alias = "StandInstDbType")]
    pub fn stand_inst_db_type(&self) -> Result<Option<StandInstDbType>, InvalidValue> {
        Ok(self.0.get_int(Tag(169))?.map(StandInstDbType::from_value))
    }

    /// The `StandInstDbName` (170) field.
    #[doc(alias = "StandInstDbName")]
    pub fn stand_inst_db_name(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(170))
    }

    /// The `StandInstDbID` (171) field.
    #[doc(alias = "StandInstDbID")]
    pub fn stand_inst_db_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(171))
    }

    /// The `SettlDeliveryType` (172) field.
    #[doc(alias = "SettlDeliveryType")]
    pub fn settl_delivery_type(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(172))
    }

    /// The `SettlDepositoryCode` (173) field.
    #[doc(alias = "SettlDepositoryCode")]
    pub fn settl_depository_code(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(173))
    }

    /// The `SettlBrkrCode` (174) field.
    #[doc(alias = "SettlBrkrCode")]
    pub fn settl_brkr_code(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(174))
    }

    /// The `SettlInstCode` (175) field.
    #[doc(alias = "SettlInstCode")]
    pub fn settl_inst_code(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(175))
    }

    /// The `SecuritySettlAgentName` (176) field.
    #[doc(alias = "SecuritySettlAgentName")]
    pub fn security_settl_agent_name(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(176))
    }

    /// The `SecuritySettlAgentCode` (177) field.
    #[doc(alias = "SecuritySettlAgentCode")]
    pub fn security_settl_agent_code(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(177))
    }

    /// The `SecuritySettlAgentAcctNum` (178) field.
    #[doc(alias = "SecuritySettlAgentAcctNum")]
    pub fn security_settl_agent_acct_num(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(178))
    }

    /// The `SecuritySettlAgentAcctName` (179) field.
    #[doc(alias = "SecuritySettlAgentAcctName")]
    pub fn security_settl_agent_acct_name(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(179))
    }

    /// The `SecuritySettlAgentContactName` (180) field.
    #[doc(alias = "SecuritySettlAgentContactName")]
    pub fn security_settl_agent_contact_name(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(180))
    }

    /// The `SecuritySettlAgentContactPhone` (181) field.
    #[doc(alias = "SecuritySettlAgentContactPhone")]
    pub fn security_settl_agent_contact_phone(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(181))
    }

    /// The `CashSettlAgentName` (182) field.
    #[doc(alias = "CashSettlAgentName")]
    pub fn cash_settl_agent_name(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(182))
    }

    /// The `CashSettlAgentCode` (183) field.
    #[doc(alias = "CashSettlAgentCode")]
    pub fn cash_settl_agent_code(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(183))
    }

    /// The `CashSettlAgentAcctNum` (184) field.
    #[doc(alias = "CashSettlAgentAcctNum")]
    pub fn cash_settl_agent_acct_num(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(184))
    }

    /// The `CashSettlAgentAcctName` (185) field.
    #[doc(alias = "CashSettlAgentAcctName")]
    pub fn cash_settl_agent_acct_name(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(185))
    }

    /// The `CashSettlAgentContactName` (186) field.
    #[doc(alias = "CashSettlAgentContactName")]
    pub fn cash_settl_agent_contact_name(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(186))
    }

    /// The `CashSettlAgentContactPhone` (187) field.
    #[doc(alias = "CashSettlAgentContactPhone")]
    pub fn cash_settl_agent_contact_phone(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(187))
    }
}

impl std::fmt::Debug for SettlementInstructions {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "SettlementInstructions({})", self.0)
    }
}

impl std::fmt::Display for SettlementInstructions {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(&self.0, f)
    }
}