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

use super::super::enums::{BidDescriptorType, SideValueInd};

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

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

impl<'a> BidDescReqGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(398),
        Tag(399),
        &[
            Tag(399), Tag(400), Tag(401), Tag(402), Tag(403), Tag(404), Tag(405), Tag(406),
            Tag(407), Tag(408), Tag(441),
        ],
        &[],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(399), Tag(400), Tag(401), Tag(404), Tag(441), Tag(402), Tag(403), Tag(405),
                Tag(406), Tag(407), Tag(408),
            ],
            &[],
        );
        &TAGS
    }

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

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

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

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

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

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

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

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

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

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

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

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

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