Skip to main content

refix_fix44/generated/components/
stipulations.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};
5
6use super::super::enums::StipulationType;
7
8/// An instance of the `NoStipulations` (232) group.
9#[derive(Clone, Copy)]
10pub struct Stipulations<'a>(refix_message::Scope<'a>);
11
12impl<'a> From<refix_message::Scope<'a>> for Stipulations<'a> {
13    fn from(scope: refix_message::Scope<'a>) -> Self {
14        Self(scope)
15    }
16}
17
18impl<'a> Stipulations<'a> {
19    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
20        Tag(232),
21        Tag(233),
22        &[Tag(233), Tag(234)],
23        &[],
24    );
25
26    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
27        static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(233), Tag(234)], &[]);
28        &TAGS
29    }
30
31    pub fn raw(&self) -> refix_message::Scope<'a> {
32        self.0
33    }
34
35    /// The `StipulationType` (233) field.
36    #[doc(alias = "StipulationType")]
37    pub fn stipulation_type(&self) -> Result<Option<StipulationType<'a>>, InvalidValue> {
38        Ok(self.0.get_str(Tag(233))?.map(StipulationType::from_value))
39    }
40
41    /// The `StipulationValue` (234) field.
42    #[doc(alias = "StipulationValue")]
43    pub fn stipulation_value(&self) -> Result<Option<&'a str>, InvalidValue> {
44        self.0.get_str(Tag(234))
45    }
46}
47
48impl std::fmt::Debug for Stipulations<'_> {
49    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
50        write!(f, "Stipulations({})", self.0)
51    }
52}