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::{Date, GroupTable, Instances, InvalidValue, LazyKnownTags, Tag};

use super::super::enums::OwnerType;
use super::NestedParties;

/// An instance of the `NoRegistDtls` (473) group.
#[derive(Clone, Copy)]
pub struct RgstDtlsGrp<'a>(refix_message::Scope<'a>);

impl<'a> From<refix_message::Scope<'a>> for RgstDtlsGrp<'a> {
    fn from(scope: refix_message::Scope<'a>) -> Self {
        Self(scope)
    }
}

impl<'a> RgstDtlsGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(473),
        Tag(509),
        &[Tag(474), Tag(475), Tag(482), Tag(486), Tag(509), Tag(511), Tag(522), Tag(539)],
        &[NestedParties::TABLE],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(509), Tag(511), Tag(474), Tag(482), Tag(539), Tag(522), Tag(486), Tag(475)],
            &[NestedParties::known_tags()],
        );
        &TAGS
    }

    pub fn raw(&self) -> refix_message::Scope<'a> {
        self.0
    }

    /// The `RegistDtls` (509) field.
    #[doc(alias = "RegistDtls")]
    pub fn regist_dtls(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(509))
    }

    /// The `RegistEmail` (511) field.
    #[doc(alias = "RegistEmail")]
    pub fn regist_email(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(511))
    }

    /// The `MailingDtls` (474) field.
    #[doc(alias = "MailingDtls")]
    pub fn mailing_dtls(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(474))
    }

    /// The `MailingInst` (482) field.
    #[doc(alias = "MailingInst")]
    pub fn mailing_inst(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(482))
    }

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

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

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

    /// The `InvestorCountryOfResidence` (475) field.
    #[doc(alias = "InvestorCountryOfResidence")]
    pub fn investor_country_of_residence(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(475))
    }
}

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