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

use super::super::components::{Header, ListOrdGrp, Trailer};
use super::super::enums::{
    BidType, CancellationRights, ListExecInstType, MoneyLaunderingStatus, ProgRptReqs,
};

/// The `NewOrderList` (35=E) message.
pub struct NewOrderList(RawMessage);

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

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(66), Tag(390), Tag(391), Tag(414), Tag(394), Tag(415), Tag(480), Tag(481),
                Tag(513), Tag(433), Tag(69), Tag(352), Tag(353), Tag(765), Tag(766), Tag(767),
                Tag(68), Tag(893), Tag(73),
            ],
            &[Header::known_tags(), Trailer::known_tags(), ListOrdGrp::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 `BidID` (390) field.
    #[doc(alias = "BidID")]
    pub fn bid_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(390))
    }

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

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

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

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

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

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

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

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

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

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

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

    /// The `AllowableOneSidednessPct` (765) field.
    #[doc(alias = "AllowableOneSidednessPct")]
    pub fn allowable_one_sidedness_pct(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(765))
    }

    /// The `AllowableOneSidednessValue` (766) field.
    #[doc(alias = "AllowableOneSidednessValue")]
    pub fn allowable_one_sidedness_value(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(766))
    }

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

    /// 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<'_, ListOrdGrp<'_>>, InvalidValue> {
        self.0.get_group(&ListOrdGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }
}

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

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