Skip to main content

refix_fix44/generated/components/
evnt_grp.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Date, Decimal, GroupTable, InvalidValue, LazyKnownTags, Tag};
5
6use super::super::enums::EventType;
7
8/// An instance of the `NoEvents` (864) group.
9#[derive(Clone, Copy)]
10pub struct EvntGrp<'a>(refix_message::Scope<'a>);
11
12impl<'a> From<refix_message::Scope<'a>> for EvntGrp<'a> {
13    fn from(scope: refix_message::Scope<'a>) -> Self {
14        Self(scope)
15    }
16}
17
18impl<'a> EvntGrp<'a> {
19    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
20        Tag(864),
21        Tag(865),
22        &[Tag(865), Tag(866), Tag(867), Tag(868)],
23        &[],
24    );
25
26    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
27        static TAGS: LazyKnownTags = LazyKnownTags::new(
28            &[Tag(865), Tag(866), Tag(867), Tag(868)],
29            &[],
30        );
31        &TAGS
32    }
33
34    pub fn raw(&self) -> refix_message::Scope<'a> {
35        self.0
36    }
37
38    /// The `EventType` (865) field.
39    #[doc(alias = "EventType")]
40    pub fn event_type(&self) -> Result<Option<EventType>, InvalidValue> {
41        Ok(self.0.get_int(Tag(865))?.map(EventType::from_value))
42    }
43
44    /// The `EventDate` (866) field.
45    #[doc(alias = "EventDate")]
46    pub fn event_date(&self) -> Result<Option<Date>, InvalidValue> {
47        self.0.get_date(Tag(866))
48    }
49
50    /// The `EventPx` (867) field.
51    #[doc(alias = "EventPx")]
52    pub fn event_px(&self) -> Result<Option<Decimal>, InvalidValue> {
53        self.0.get_decimal(Tag(867))
54    }
55
56    /// The `EventText` (868) field.
57    #[doc(alias = "EventText")]
58    pub fn event_text(&self) -> Result<Option<&'a str>, InvalidValue> {
59        self.0.get_str(Tag(868))
60    }
61}
62
63impl std::fmt::Debug for EvntGrp<'_> {
64    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
65        write!(f, "EvntGrp({})", self.0)
66    }
67}