refix-fix44 0.12.0

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

use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag, UtcTimestamp};

use super::super::components::{Header, Parties, Trailer};
use super::super::enums::{Product, SecurityType, Side, StandInstDbType};

/// The `SettlementInstructionRequest` (35=AV) message.
pub struct SettlementInstructionRequest(RawMessage);

impl SettlementInstructionRequest {
    pub const MSG_TYPE: &[u8] = b"AV";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(791), Tag(60), Tag(453), Tag(79), Tag(661), Tag(54), Tag(460), Tag(167),
                Tag(461), Tag(168), Tag(126), Tag(779), Tag(169), Tag(170), Tag(171),
            ],
            &[Header::known_tags(), Trailer::known_tags(), Parties::known_tags()],
        );
        &TAGS
    }

    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(), Self::known_tags().get())
    }

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

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

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

    /// The instances of the `NoPartyIDs` (453) group.
    #[doc(alias = "NoPartyIDs")]
    pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
        self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

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

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

    /// 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 `Product` (460) field.
    #[doc(alias = "Product")]
    pub fn product(&self) -> Result<Option<Product>, InvalidValue> {
        Ok(self.0.get_int(Tag(460))?.map(Product::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 `CFICode` (461) field.
    #[doc(alias = "CFICode")]
    pub fn cfi_code(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(461))
    }

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

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

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

    /// 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))
    }
}

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

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