Skip to main content

refix_fix44/generated/components/
trailer.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{InvalidValue, LazyKnownTags, Tag};
5
6/// The trailer fields of a message.
7#[derive(Clone, Copy)]
8pub struct Trailer<'a>(pub(in super::super) refix_message::Scope<'a>);
9
10impl<'a> From<refix_message::Scope<'a>> for Trailer<'a> {
11    fn from(scope: refix_message::Scope<'a>) -> Self {
12        Self(scope)
13    }
14}
15
16impl<'a> Trailer<'a> {
17    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
18        static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(93), Tag(89), Tag(10)], &[]);
19        &TAGS
20    }
21
22    pub fn raw(&self) -> refix_message::Scope<'a> {
23        self.0
24    }
25
26    /// The `SignatureLength` (93) field.
27    #[doc(alias = "SignatureLength")]
28    pub fn signature_length(&self) -> Result<Option<i64>, InvalidValue> {
29        self.0.get_int(Tag(93))
30    }
31
32    /// The `Signature` (89) field.
33    #[doc(alias = "Signature")]
34    pub fn signature(&self) -> Option<&'a [u8]> {
35        self.0.get(Tag(89))
36    }
37
38    /// The `CheckSum` (10) field.
39    #[doc(alias = "CheckSum")]
40    pub fn check_sum(&self) -> Result<Option<&'a str>, InvalidValue> {
41        self.0.get_str(Tag(10))
42    }
43}
44
45impl std::fmt::Debug for Trailer<'_> {
46    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
47        write!(f, "Trailer({})", self.0.display_known(&Self::known_tags().get()))
48    }
49}