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

use super::super::components::{Header, Trailer};

/// The `SequenceReset` (35=4) message.
pub struct SequenceReset(RawMessage);

impl SequenceReset {
    pub const MSG_TYPE: &[u8] = b"4";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(123), Tag(36)],
            &[Header::known_tags(), Trailer::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 `GapFillFlag` (123) field.
    #[doc(alias = "GapFillFlag")]
    pub fn gap_fill_flag(&self) -> Result<Option<bool>, InvalidValue> {
        self.0.get_bool(Tag(123))
    }

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

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

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