#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Decimal, GroupTable, InvalidValue, LazyKnownTags, Tag, UtcTimestamp};
#[derive(Clone, Copy)]
pub struct ContraGrp<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for ContraGrp<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> ContraGrp<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(382),
Tag(375),
&[Tag(337), Tag(375), Tag(437), Tag(438), Tag(655)],
&[],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[Tag(375), Tag(337), Tag(437), Tag(438), Tag(655)],
&[],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "ContraBroker")]
pub fn contra_broker(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(375))
}
#[doc(alias = "ContraTrader")]
pub fn contra_trader(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(337))
}
#[doc(alias = "ContraTradeQty")]
pub fn contra_trade_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(437))
}
#[doc(alias = "ContraTradeTime")]
pub fn contra_trade_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
self.0.get_utc_timestamp(Tag(438))
}
#[doc(alias = "ContraLegRefID")]
pub fn contra_leg_ref_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(655))
}
}
impl std::fmt::Debug for ContraGrp<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "ContraGrp({})", self.0)
}
}