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::{Date, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag, UtcTimestamp};

use super::super::components::{AllocAckGrp, Header, Parties, Trailer};
use super::super::enums::{
    AllocIntermedReqType, AllocRejCode, AllocReportType, AllocStatus, MatchStatus, Product,
    SecurityType,
};

/// The `AllocationReportAck` (35=AT) message.
pub struct AllocationReportAck(RawMessage);

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

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(755), Tag(70), Tag(453), Tag(793), Tag(75), Tag(60), Tag(87), Tag(88), Tag(794),
                Tag(808), Tag(573), Tag(460), Tag(167), Tag(58), Tag(354), Tag(355), Tag(78),
            ],
            &[
                Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
                AllocAckGrp::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 `AllocReportID` (755) field.
    #[doc(alias = "AllocReportID")]
    pub fn alloc_report_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(755))
    }

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

    /// 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 `SecondaryAllocID` (793) field.
    #[doc(alias = "SecondaryAllocID")]
    pub fn secondary_alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(793))
    }

    /// The `TradeDate` (75) field.
    #[doc(alias = "TradeDate")]
    pub fn trade_date(&self) -> Result<Option<Date>, InvalidValue> {
        self.0.get_date(Tag(75))
    }

    /// The `TransactTime` (60) field.
    #[doc(alias = "TransactTime")]
    pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
        self.0.get_utc_timestamp(Tag(60))
    }

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

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

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

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

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

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

    /// The `SecurityType` (167) field.
    #[doc(alias = "SecurityType")]
    pub fn security_type(&self) -> Result<Option<SecurityType<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(167))?.map(SecurityType::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 `NoAllocs` (78) group.
    #[doc(alias = "NoAllocs")]
    pub fn allocs(&self) -> Result<Instances<'_, AllocAckGrp<'_>>, InvalidValue> {
        self.0.get_group(&AllocAckGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }
}

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

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