Skip to main content

refix_fix44/generated/components/
trd_reg_timestamps.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{GroupTable, InvalidValue, LazyKnownTags, Tag, UtcTimestamp};
5
6use super::super::enums::TrdRegTimestampType;
7
8/// An instance of the `NoTrdRegTimestamps` (768) group.
9#[derive(Clone, Copy)]
10pub struct TrdRegTimestamps<'a>(refix_message::Scope<'a>);
11
12impl<'a> From<refix_message::Scope<'a>> for TrdRegTimestamps<'a> {
13    fn from(scope: refix_message::Scope<'a>) -> Self {
14        Self(scope)
15    }
16}
17
18impl<'a> TrdRegTimestamps<'a> {
19    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
20        Tag(768),
21        Tag(769),
22        &[Tag(769), Tag(770), Tag(771)],
23        &[],
24    );
25
26    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
27        static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(769), Tag(770), Tag(771)], &[]);
28        &TAGS
29    }
30
31    pub fn raw(&self) -> refix_message::Scope<'a> {
32        self.0
33    }
34
35    /// The `TrdRegTimestamp` (769) field.
36    #[doc(alias = "TrdRegTimestamp")]
37    pub fn trd_reg_timestamp(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
38        self.0.get_utc_timestamp(Tag(769))
39    }
40
41    /// The `TrdRegTimestampType` (770) field.
42    #[doc(alias = "TrdRegTimestampType")]
43    pub fn trd_reg_timestamp_type(&self) -> Result<Option<TrdRegTimestampType>, InvalidValue> {
44        Ok(self.0.get_int(Tag(770))?.map(TrdRegTimestampType::from_value))
45    }
46
47    /// The `TrdRegTimestampOrigin` (771) field.
48    #[doc(alias = "TrdRegTimestampOrigin")]
49    pub fn trd_reg_timestamp_origin(&self) -> Result<Option<&'a str>, InvalidValue> {
50        self.0.get_str(Tag(771))
51    }
52}
53
54impl std::fmt::Debug for TrdRegTimestamps<'_> {
55    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
56        write!(f, "TrdRegTimestamps({})", self.0)
57    }
58}