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, MDIncGrp, Trailer};
use super::super::enums::ApplQueueResolution;

/// The `MarketDataIncrementalRefresh` (35=X) message.
pub struct MarketDataIncrementalRefresh(RawMessage);

impl MarketDataIncrementalRefresh {
    pub const MSG_TYPE: &[u8] = b"X";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(262), Tag(268), Tag(813), Tag(814)],
            &[Header::known_tags(), Trailer::known_tags(), MDIncGrp::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 instances of the `NoMDEntries` (268) group.
    #[doc(alias = "NoMDEntries")]
    pub fn md_entries(&self) -> Result<Instances<'_, MDIncGrp<'_>>, InvalidValue> {
        self.0.get_group(&MDIncGrp::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 MarketDataIncrementalRefresh {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "MarketDataIncrementalRefresh({})", self.0)
    }
}

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