#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{InvalidValue, LazyKnownTags, Tag};
#[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
}
#[doc(alias = "SignatureLength")]
pub fn signature_length(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(93))
}
#[doc(alias = "Signature")]
pub fn signature(&self) -> Option<&'a [u8]> {
self.0.get(Tag(89))
}
#[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()))
}
}