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, Decimal, GroupTable, InvalidValue, LazyKnownTags, Tag};

use super::super::enums::{NetGrossInd, PriceType, SettlType, Side};
use super::CommissionData;

/// An instance of the `NoBidComponents` (420) group.
#[derive(Clone, Copy)]
pub struct BidCompRspGrp<'a>(refix_message::Scope<'a>);

impl<'a> From<refix_message::Scope<'a>> for BidCompRspGrp<'a> {
    fn from(scope: refix_message::Scope<'a>) -> Self {
        Self(scope)
    }
}

impl<'a> BidCompRspGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(420),
        Tag(12),
        &[
            Tag(12), Tag(13), Tag(44), Tag(54), Tag(58), Tag(63), Tag(64), Tag(66), Tag(336),
            Tag(354), Tag(355), Tag(406), Tag(421), Tag(423), Tag(430), Tag(479), Tag(497),
            Tag(625),
        ],
        &[],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(66), Tag(421), Tag(54), Tag(44), Tag(423), Tag(406), Tag(430), Tag(63), Tag(64),
                Tag(336), Tag(625), Tag(58), Tag(354), Tag(355),
            ],
            &[CommissionData::known_tags()],
        );
        &TAGS
    }

    pub fn raw(&self) -> refix_message::Scope<'a> {
        self.0
    }

    /// The `CommissionData` component.
    pub fn commission_data(&self) -> CommissionData<'a> {
        CommissionData(self.0)
    }

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

    /// The `Country` (421) field.
    #[doc(alias = "Country")]
    pub fn country(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(421))
    }

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

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

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

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

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

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

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

    /// The `TradingSessionID` (336) field.
    #[doc(alias = "TradingSessionID")]
    pub fn trading_session_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(336))
    }

    /// The `TradingSessionSubID` (625) field.
    #[doc(alias = "TradingSessionSubID")]
    pub fn trading_session_sub_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(625))
    }

    /// The `Text` (58) field.
    #[doc(alias = "Text")]
    pub fn text(&self) -> Result<Option<&'a 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<&'a [u8]> {
        self.0.get(Tag(355))
    }
}

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