#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Decimal, GroupTable, InvalidValue, LazyKnownTags, Tag};
use super::super::enums::ContAmtType;
#[derive(Clone, Copy)]
pub struct ContAmtGrp<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for ContAmtGrp<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> ContAmtGrp<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(518),
Tag(519),
&[Tag(519), Tag(520), Tag(521)],
&[],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(519), Tag(520), Tag(521)], &[]);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "ContAmtType")]
pub fn cont_amt_type(&self) -> Result<Option<ContAmtType>, InvalidValue> {
Ok(self.0.get_int(Tag(519))?.map(ContAmtType::from_value))
}
#[doc(alias = "ContAmtValue")]
pub fn cont_amt_value(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(520))
}
#[doc(alias = "ContAmtCurr")]
pub fn cont_amt_curr(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(521))
}
}
impl std::fmt::Debug for ContAmtGrp<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "ContAmtGrp({})", self.0)
}
}