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::{Header, OrdListStatGrp, Trailer};
use super::super::enums::{ListOrderStatus, ListStatusType};

/// The `ListStatus` (35=N) message.
pub struct ListStatus(RawMessage);

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

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(66), Tag(429), Tag(82), Tag(431), Tag(83), Tag(444), Tag(445), Tag(446),
                Tag(60), Tag(68), Tag(893), Tag(73),
            ],
            &[Header::known_tags(), Trailer::known_tags(), OrdListStatGrp::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 `ListID` (66) field.
    #[doc(alias = "ListID")]
    pub fn list_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(66))
    }

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

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

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

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

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

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

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

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

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

    /// The `LastFragment` (893) field.
    #[doc(alias = "LastFragment")]
    pub fn last_fragment(&self) -> Result<Option<bool>, InvalidValue> {
        self.0.get_bool(Tag(893))
    }

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

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

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