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

use super::super::enums::DistribPaymentMethod;

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

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

impl<'a> RgstDistInstGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(510),
        Tag(477),
        &[Tag(477), Tag(478), Tag(498), Tag(499), Tag(500), Tag(501), Tag(502), Tag(512)],
        &[],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(477), Tag(512), Tag(478), Tag(498), Tag(499), Tag(500), Tag(501), Tag(502)],
            &[],
        );
        &TAGS
    }

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

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

    /// The `DistribPercentage` (512) field.
    #[doc(alias = "DistribPercentage")]
    pub fn distrib_percentage(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(512))
    }

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

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

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

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

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

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

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