refix-fix44 0.12.0

Typed FIX 4.4 protocol messages for the ReFIX engine
Documentation
// @generated by refix codegen from FIX44.xml. Do not edit.
#![cfg_attr(rustfmt, rustfmt::skip)]

use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};

use super::super::components::{Header, RFQReqGrp, Trailer};
use super::super::enums::SubscriptionRequestType;

/// The `RFQRequest` (35=AH) message.
pub struct RFQRequest(RawMessage);

impl RFQRequest {
    pub const MSG_TYPE: &[u8] = b"AH";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(644), Tag(146), Tag(263)],
            &[Header::known_tags(), Trailer::known_tags(), RFQReqGrp::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())
    }

    /// The `RFQReqID` (644) field.
    #[doc(alias = "RFQReqID")]
    pub fn rfq_req_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(644))
    }

    /// The instances of the `NoRelatedSym` (146) group.
    #[doc(alias = "NoRelatedSym")]
    pub fn related_sym(&self) -> Result<Instances<'_, RFQReqGrp<'_>>, InvalidValue> {
        self.0.get_group(&RFQReqGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

    /// The `SubscriptionRequestType` (263) field.
    #[doc(alias = "SubscriptionRequestType")]
    pub fn subscription_request_type(&self) -> Result<Option<SubscriptionRequestType<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(263))?.map(SubscriptionRequestType::from_value))
    }
}

impl std::fmt::Debug for RFQRequest {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "RFQRequest({})", self.0)
    }
}

impl std::fmt::Display for RFQRequest {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(&self.0, f)
    }
}