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::{Date, Decimal, GroupTable, InvalidValue, LazyKnownTags, Tag};

use super::super::enums::EventType;

/// An instance of the `NoEvents` (864) group.
#[derive(Clone, Copy)]
pub struct EvntGrp<'a>(refix_message::Scope<'a>);

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

impl<'a> EvntGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(864),
        Tag(865),
        &[Tag(865), Tag(866), Tag(867), Tag(868)],
        &[],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(865), Tag(866), Tag(867), Tag(868)],
            &[],
        );
        &TAGS
    }

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

    /// The `EventType` (865) field.
    #[doc(alias = "EventType")]
    pub fn event_type(&self) -> Result<Option<EventType>, InvalidValue> {
        Ok(self.0.get_int(Tag(865))?.map(EventType::from_value))
    }

    /// The `EventDate` (866) field.
    #[doc(alias = "EventDate")]
    pub fn event_date(&self) -> Result<Option<Date>, InvalidValue> {
        self.0.get_date(Tag(866))
    }

    /// The `EventPx` (867) field.
    #[doc(alias = "EventPx")]
    pub fn event_px(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(867))
    }

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

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