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, Tag};

/// The trailer fields of a message.
#[derive(Clone, Copy)]
pub struct Trailer<'a>(pub(in super::super) refix_message::Scope<'a>);

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

impl<'a> Trailer<'a> {
    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(93), Tag(89), Tag(10)], &[]);
        &TAGS
    }

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

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

    /// The `Signature` (89) field.
    #[doc(alias = "Signature")]
    pub fn signature(&self) -> Option<&'a [u8]> {
        self.0.get(Tag(89))
    }

    /// The `CheckSum` (10) field.
    #[doc(alias = "CheckSum")]
    pub fn check_sum(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(10))
    }
}

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