Skip to main content

refix_fix44/generated/components/
instrument_extension.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Decimal, Instances, InvalidValue, KnownTags, LazyKnownTags, Tag};
5
6use super::super::enums::DeliveryForm;
7use super::AttrbGrp;
8
9/// The fields of the `InstrumentExtension` component.
10#[derive(Clone, Copy)]
11pub struct InstrumentExtension<'a>(
12    pub(in super::super) refix_message::Scope<'a>,
13    pub(in super::super) KnownTags<'static>,
14);
15
16impl<'a> InstrumentExtension<'a> {
17    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
18        static TAGS: LazyKnownTags = LazyKnownTags::new(
19            &[Tag(668), Tag(869), Tag(870)],
20            &[AttrbGrp::known_tags()],
21        );
22        &TAGS
23    }
24
25    pub fn raw(&self) -> refix_message::Scope<'a> {
26        self.0
27    }
28
29    /// The `DeliveryForm` (668) field.
30    #[doc(alias = "DeliveryForm")]
31    pub fn delivery_form(&self) -> Result<Option<DeliveryForm>, InvalidValue> {
32        Ok(self.0.get_int(Tag(668))?.map(DeliveryForm::from_value))
33    }
34
35    /// The `PctAtRisk` (869) field.
36    #[doc(alias = "PctAtRisk")]
37    pub fn pct_at_risk(&self) -> Result<Option<Decimal>, InvalidValue> {
38        self.0.get_decimal(Tag(869))
39    }
40
41    /// The instances of the `NoInstrAttrib` (870) group.
42    #[doc(alias = "NoInstrAttrib")]
43    pub fn instr_attrib(&self) -> Result<Instances<'a, AttrbGrp<'a>>, InvalidValue> {
44        self.0.get_group(&AttrbGrp::TABLE, &self.1).map(Instances::from)
45    }
46}
47
48impl std::fmt::Debug for InstrumentExtension<'_> {
49    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
50        write!(f, "InstrumentExtension({})", self.0.display_known(&Self::known_tags().get()))
51    }
52}