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, InstrmtStrkPxGrp, Trailer, UndInstrmtStrkPxGrp};

/// The `ListStrikePrice` (35=m) message.
pub struct ListStrikePrice(RawMessage);

impl ListStrikePrice {
    pub const MSG_TYPE: &[u8] = b"m";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(66), Tag(422), Tag(893), Tag(428), Tag(711)],
            &[
                Header::known_tags(), Trailer::known_tags(), InstrmtStrkPxGrp::known_tags(),
                UndInstrmtStrkPxGrp::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 `ListID` (66) field.
    #[doc(alias = "ListID")]
    pub fn list_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(66))
    }

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

    /// The `LastFragment` (893) field.
    #[doc(alias = "LastFragment")]
    pub fn last_fragment(&self) -> Result<Option<bool>, InvalidValue> {
        self.0.get_bool(Tag(893))
    }

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

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

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

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