#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Decimal, GroupTable, InvalidValue, LazyKnownTags, Tag};
use super::super::enums::LastCapacity;
#[derive(Clone, Copy)]
pub struct ExecAllocGrp<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for ExecAllocGrp<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> ExecAllocGrp<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(124),
Tag(32),
&[Tag(17), Tag(29), Tag(31), Tag(32), Tag(527), Tag(669)],
&[],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[Tag(32), Tag(17), Tag(527), Tag(31), Tag(669), Tag(29)],
&[],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "LastQty")]
pub fn last_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(32))
}
#[doc(alias = "ExecID")]
pub fn exec_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(17))
}
#[doc(alias = "SecondaryExecID")]
pub fn secondary_exec_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(527))
}
#[doc(alias = "LastPx")]
pub fn last_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(31))
}
#[doc(alias = "LastParPx")]
pub fn last_par_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(669))
}
#[doc(alias = "LastCapacity")]
pub fn last_capacity(&self) -> Result<Option<LastCapacity<'a>>, InvalidValue> {
Ok(self.0.get_str(Tag(29))?.map(LastCapacity::from_value))
}
}
impl std::fmt::Debug for ExecAllocGrp<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "ExecAllocGrp({})", self.0)
}
}