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

use super::super::enums::{DlvyInstType, SettlInstSource};
use super::SettlParties;

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

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

impl<'a> DlvyInstGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(85),
        Tag(165),
        &[Tag(165), Tag(781), Tag(787)],
        &[SettlParties::TABLE],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(165), Tag(787), Tag(781)],
            &[SettlParties::known_tags()],
        );
        &TAGS
    }

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

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

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

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

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