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, Instances, InvalidValue, LazyKnownTags, MultipleValues, RawMessage, Tag,
};

use super::super::components::{
    Header, InstrmtLegGrp, Instrument, MDFullGrp, Trailer, UndInstrmtGrp,
};
use super::super::enums::{ApplQueueResolution, CorporateAction, FinancialStatus};

/// The `MarketDataSnapshotFullRefresh` (35=W) message.
pub struct MarketDataSnapshotFullRefresh(RawMessage);

impl MarketDataSnapshotFullRefresh {
    pub const MSG_TYPE: &[u8] = b"W";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(262), Tag(711), Tag(555), Tag(291), Tag(292), Tag(451), Tag(268), Tag(813),
                Tag(814),
            ],
            &[
                Header::known_tags(), Trailer::known_tags(), Instrument::known_tags(),
                UndInstrmtGrp::known_tags(), InstrmtLegGrp::known_tags(), MDFullGrp::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 `MDReqID` (262) field.
    #[doc(alias = "MDReqID")]
    pub fn md_req_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(262))
    }

    /// The `Instrument` component.
    pub fn instrument(&self) -> Instrument<'_> {
        Instrument(self.0.scope(), Self::known_tags().get())
    }

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

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

    /// The `FinancialStatus` (291) field.
    #[doc(alias = "FinancialStatus")]
    pub fn financial_status(&self) -> Result<Option<MultipleValues<'_, FinancialStatus<'_>>>, InvalidValue> {
        self.0.get_multiple_values(Tag(291))
    }

    /// The `CorporateAction` (292) field.
    #[doc(alias = "CorporateAction")]
    pub fn corporate_action(&self) -> Result<Option<MultipleValues<'_, CorporateAction<'_>>>, InvalidValue> {
        self.0.get_multiple_values(Tag(292))
    }

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

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

    /// The `ApplQueueDepth` (813) field.
    #[doc(alias = "ApplQueueDepth")]
    pub fn appl_queue_depth(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(813))
    }

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

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

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