#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};
use super::super::components::{Header, MDIncGrp, Trailer};
use super::super::enums::ApplQueueResolution;
pub struct MarketDataIncrementalRefresh(RawMessage);
impl MarketDataIncrementalRefresh {
pub const MSG_TYPE: &[u8] = b"X";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[Tag(262), Tag(268), Tag(813), Tag(814)],
&[Header::known_tags(), Trailer::known_tags(), MDIncGrp::known_tags()],
);
&TAGS
}
pub fn from_raw(raw: RawMessage) -> Self {
Self(raw)
}
pub fn raw(&self) -> &RawMessage {
&self.0
}
pub fn header(&self) -> Header<'_> {
Header(self.0.scope(), Self::known_tags().get())
}
pub fn trailer(&self) -> Trailer<'_> {
Trailer(self.0.scope())
}
#[doc(alias = "MDReqID")]
pub fn md_req_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(262))
}
#[doc(alias = "NoMDEntries")]
pub fn md_entries(&self) -> Result<Instances<'_, MDIncGrp<'_>>, InvalidValue> {
self.0.get_group(&MDIncGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "ApplQueueDepth")]
pub fn appl_queue_depth(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(813))
}
#[doc(alias = "ApplQueueResolution")]
pub fn appl_queue_resolution(&self) -> Result<Option<ApplQueueResolution>, InvalidValue> {
Ok(self.0.get_int(Tag(814))?.map(ApplQueueResolution::from_value))
}
}
impl std::fmt::Debug for MarketDataIncrementalRefresh {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "MarketDataIncrementalRefresh({})", self.0)
}
}
impl std::fmt::Display for MarketDataIncrementalRefresh {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}