Skip to main content

refix_fix44/generated/components/
peg_instructions.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Decimal, InvalidValue, LazyKnownTags, Tag};
5
6use super::super::enums::{PegLimitType, PegMoveType, PegOffsetType, PegRoundDirection, PegScope};
7
8/// The fields of the `PegInstructions` component.
9#[derive(Clone, Copy)]
10pub struct PegInstructions<'a>(pub(in super::super) refix_message::Scope<'a>);
11
12impl<'a> PegInstructions<'a> {
13    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
14        static TAGS: LazyKnownTags = LazyKnownTags::new(
15            &[Tag(211), Tag(835), Tag(836), Tag(837), Tag(838), Tag(840)],
16            &[],
17        );
18        &TAGS
19    }
20
21    pub fn raw(&self) -> refix_message::Scope<'a> {
22        self.0
23    }
24
25    /// The `PegOffsetValue` (211) field.
26    #[doc(alias = "PegOffsetValue")]
27    pub fn peg_offset_value(&self) -> Result<Option<Decimal>, InvalidValue> {
28        self.0.get_decimal(Tag(211))
29    }
30
31    /// The `PegMoveType` (835) field.
32    #[doc(alias = "PegMoveType")]
33    pub fn peg_move_type(&self) -> Result<Option<PegMoveType>, InvalidValue> {
34        Ok(self.0.get_int(Tag(835))?.map(PegMoveType::from_value))
35    }
36
37    /// The `PegOffsetType` (836) field.
38    #[doc(alias = "PegOffsetType")]
39    pub fn peg_offset_type(&self) -> Result<Option<PegOffsetType>, InvalidValue> {
40        Ok(self.0.get_int(Tag(836))?.map(PegOffsetType::from_value))
41    }
42
43    /// The `PegLimitType` (837) field.
44    #[doc(alias = "PegLimitType")]
45    pub fn peg_limit_type(&self) -> Result<Option<PegLimitType>, InvalidValue> {
46        Ok(self.0.get_int(Tag(837))?.map(PegLimitType::from_value))
47    }
48
49    /// The `PegRoundDirection` (838) field.
50    #[doc(alias = "PegRoundDirection")]
51    pub fn peg_round_direction(&self) -> Result<Option<PegRoundDirection>, InvalidValue> {
52        Ok(self.0.get_int(Tag(838))?.map(PegRoundDirection::from_value))
53    }
54
55    /// The `PegScope` (840) field.
56    #[doc(alias = "PegScope")]
57    pub fn peg_scope(&self) -> Result<Option<PegScope>, InvalidValue> {
58        Ok(self.0.get_int(Tag(840))?.map(PegScope::from_value))
59    }
60}
61
62impl std::fmt::Debug for PegInstructions<'_> {
63    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
64        write!(f, "PegInstructions({})", self.0.display_known(&Self::known_tags().get()))
65    }
66}