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

use super::super::enums::RoundingDirection;

/// The fields of the `OrderQtyData` component.
#[derive(Clone, Copy)]
pub struct OrderQtyData<'a>(pub(in super::super) refix_message::Scope<'a>);

impl<'a> OrderQtyData<'a> {
    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[Tag(38), Tag(152), Tag(516), Tag(468), Tag(469)],
            &[],
        );
        &TAGS
    }

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

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

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

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

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

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

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