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};

use super::super::components::{Header, Parties, RgstDistInstGrp, RgstDtlsGrp, Trailer};
use super::super::enums::{AcctIDSource, OwnershipType, RegistTransType, TaxAdvantageType};

/// The `RegistrationInstructions` (35=o) message.
pub struct RegistrationInstructions(RawMessage);

impl RegistrationInstructions {
    pub const MSG_TYPE: &[u8] = b"o";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(513), Tag(514), Tag(508), Tag(11), Tag(453), Tag(1), Tag(660), Tag(493),
                Tag(495), Tag(517), Tag(473), Tag(510),
            ],
            &[
                Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
                RgstDtlsGrp::known_tags(), RgstDistInstGrp::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 `RegistID` (513) field.
    #[doc(alias = "RegistID")]
    pub fn regist_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(513))
    }

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

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

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

    /// 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 `Account` (1) field.
    #[doc(alias = "Account")]
    pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(1))
    }

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

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

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

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

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

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

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

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