#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{GroupTable, InvalidValue, LazyKnownTags, Tag};
use super::super::enums::StipulationType;
#[derive(Clone, Copy)]
pub struct Stipulations<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for Stipulations<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> Stipulations<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(232),
Tag(233),
&[Tag(233), Tag(234)],
&[],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(233), Tag(234)], &[]);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "StipulationType")]
pub fn stipulation_type(&self) -> Result<Option<StipulationType<'a>>, InvalidValue> {
Ok(self.0.get_str(Tag(233))?.map(StipulationType::from_value))
}
#[doc(alias = "StipulationValue")]
pub fn stipulation_value(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(234))
}
}
impl std::fmt::Debug for Stipulations<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Stipulations({})", self.0)
}
}