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, Parties, QuotSetAckGrp, Trailer};
use super::super::enums::{
    AccountType, AcctIDSource, QuoteRejectReason, QuoteResponseLevel, QuoteStatus, QuoteType,
};

/// The `MassQuoteAcknowledgement` (35=b) message.
pub struct MassQuoteAcknowledgement(RawMessage);

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

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(131), Tag(117), Tag(297), Tag(300), Tag(301), Tag(537), Tag(453), Tag(1),
                Tag(660), Tag(581), Tag(58), Tag(354), Tag(355), Tag(296),
            ],
            &[
                Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
                QuotSetAckGrp::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 `QuoteReqID` (131) field.
    #[doc(alias = "QuoteReqID")]
    pub fn quote_req_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(131))
    }

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

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

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

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

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

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

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

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

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

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

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

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

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