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, UtcTimestamp};

use super::super::components::{
    FinancingDetails, Header, Instrument, OrderQtyData, Parties, Trailer, UndInstrmtGrp,
};
use super::super::enums::{AccountType, AcctIDSource, Side};

/// The `OrderCancelRequest` (35=F) message.
pub struct OrderCancelRequest(RawMessage);

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

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(41), Tag(37), Tag(11), Tag(526), Tag(583), Tag(66), Tag(586), Tag(1), Tag(660),
                Tag(581), Tag(453), Tag(711), Tag(54), Tag(60), Tag(376), Tag(58), Tag(354),
                Tag(355),
            ],
            &[
                Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
                Instrument::known_tags(), FinancingDetails::known_tags(),
                UndInstrmtGrp::known_tags(), OrderQtyData::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 `OrigClOrdID` (41) field.
    #[doc(alias = "OrigClOrdID")]
    pub fn orig_cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(41))
    }

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

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

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

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

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

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

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

    /// The `FinancingDetails` component.
    pub fn financing_details(&self) -> FinancingDetails<'_> {
        FinancingDetails(self.0.scope())
    }

    /// 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 `Side` (54) field.
    #[doc(alias = "Side")]
    pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
    }

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

    /// The `OrderQtyData` component.
    pub fn order_qty_data(&self) -> OrderQtyData<'_> {
        OrderQtyData(self.0.scope())
    }

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

    /// 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 OrderCancelRequest {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "OrderCancelRequest({})", self.0)
    }
}

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