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, InstrmtLegGrp, Instrument, Trailer, UndInstrmtGrp};
use super::super::enums::{
    MultiLegReportingType, ResponseTransportType, SubscriptionRequestType, TradeRequestResult,
    TradeRequestStatus, TradeRequestType,
};

/// The `TradeCaptureReportRequestAck` (35=AQ) message.
pub struct TradeCaptureReportRequestAck(RawMessage);

impl TradeCaptureReportRequestAck {
    pub const MSG_TYPE: &[u8] = b"AQ";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(568), Tag(569), Tag(263), Tag(748), Tag(749), Tag(750), Tag(711), Tag(555),
                Tag(442), Tag(725), Tag(726), Tag(58), Tag(354), Tag(355),
            ],
            &[
                Header::known_tags(), Trailer::known_tags(), Instrument::known_tags(),
                UndInstrmtGrp::known_tags(), InstrmtLegGrp::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 `TradeRequestID` (568) field.
    #[doc(alias = "TradeRequestID")]
    pub fn trade_request_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(568))
    }

    /// The `TradeRequestType` (569) field.
    #[doc(alias = "TradeRequestType")]
    pub fn trade_request_type(&self) -> Result<Option<TradeRequestType>, InvalidValue> {
        Ok(self.0.get_int(Tag(569))?.map(TradeRequestType::from_value))
    }

    /// 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))
    }

    /// The `TotNumTradeReports` (748) field.
    #[doc(alias = "TotNumTradeReports")]
    pub fn tot_num_trade_reports(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(748))
    }

    /// The `TradeRequestResult` (749) field.
    #[doc(alias = "TradeRequestResult")]
    pub fn trade_request_result(&self) -> Result<Option<TradeRequestResult>, InvalidValue> {
        Ok(self.0.get_int(Tag(749))?.map(TradeRequestResult::from_value))
    }

    /// The `TradeRequestStatus` (750) field.
    #[doc(alias = "TradeRequestStatus")]
    pub fn trade_request_status(&self) -> Result<Option<TradeRequestStatus>, InvalidValue> {
        Ok(self.0.get_int(Tag(750))?.map(TradeRequestStatus::from_value))
    }

    /// The `Instrument` component.
    pub fn instrument(&self) -> Instrument<'_> {
        Instrument(self.0.scope(), Self::known_tags().get())
    }

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

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

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

    /// The `ResponseTransportType` (725) field.
    #[doc(alias = "ResponseTransportType")]
    pub fn response_transport_type(&self) -> Result<Option<ResponseTransportType>, InvalidValue> {
        Ok(self.0.get_int(Tag(725))?.map(ResponseTransportType::from_value))
    }

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

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

    /// The `EncodedTextLen` (354) field.
    #[doc(alias = "EncodedTextLen")]
    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(354))
    }

    /// The `EncodedText` (355) field.
    #[doc(alias = "EncodedText")]
    pub fn encoded_text(&self) -> Option<&[u8]> {
        self.0.get(Tag(355))
    }
}

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

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