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, Trailer};
use super::super::enums::{AcctIDSource, RegistRejReasonCode, RegistStatus, RegistTransType};

/// The `RegistrationInstructionsResponse` (35=p) message.
pub struct RegistrationInstructionsResponse(RawMessage);

impl RegistrationInstructionsResponse {
    pub const MSG_TYPE: &[u8] = b"p";

    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(506),
                Tag(507), Tag(496),
            ],
            &[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 `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 `RegistStatus` (506) field.
    #[doc(alias = "RegistStatus")]
    pub fn regist_status(&self) -> Result<Option<RegistStatus<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(506))?.map(RegistStatus::from_value))
    }

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

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

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

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