#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};
use super::super::components::{BidCompRspGrp, Header, Trailer};
pub struct BidResponse(RawMessage);
impl BidResponse {
pub const MSG_TYPE: &[u8] = b"l";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[Tag(390), Tag(391), Tag(420)],
&[Header::known_tags(), Trailer::known_tags(), BidCompRspGrp::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 = "BidID")]
pub fn bid_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(390))
}
#[doc(alias = "ClientBidID")]
pub fn client_bid_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(391))
}
#[doc(alias = "NoBidComponents")]
pub fn bid_components(&self) -> Result<Instances<'_, BidCompRspGrp<'_>>, InvalidValue> {
self.0.get_group(&BidCompRspGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
}
impl std::fmt::Debug for BidResponse {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "BidResponse({})", self.0)
}
}
impl std::fmt::Display for BidResponse {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}