refix_fix44/generated/components/
discretion_instructions.rs1#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Decimal, InvalidValue, LazyKnownTags, Tag};
5
6use super::super::enums::{
7 DiscretionInst, DiscretionLimitType, DiscretionMoveType, DiscretionOffsetType,
8 DiscretionRoundDirection, DiscretionScope,
9};
10
11#[derive(Clone, Copy)]
13pub struct DiscretionInstructions<'a>(pub(in super::super) refix_message::Scope<'a>);
14
15impl<'a> DiscretionInstructions<'a> {
16 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
17 static TAGS: LazyKnownTags = LazyKnownTags::new(
18 &[Tag(388), Tag(389), Tag(841), Tag(842), Tag(843), Tag(844), Tag(846)],
19 &[],
20 );
21 &TAGS
22 }
23
24 pub fn raw(&self) -> refix_message::Scope<'a> {
25 self.0
26 }
27
28 #[doc(alias = "DiscretionInst")]
30 pub fn discretion_inst(&self) -> Result<Option<DiscretionInst<'a>>, InvalidValue> {
31 Ok(self.0.get_str(Tag(388))?.map(DiscretionInst::from_value))
32 }
33
34 #[doc(alias = "DiscretionOffsetValue")]
36 pub fn discretion_offset_value(&self) -> Result<Option<Decimal>, InvalidValue> {
37 self.0.get_decimal(Tag(389))
38 }
39
40 #[doc(alias = "DiscretionMoveType")]
42 pub fn discretion_move_type(&self) -> Result<Option<DiscretionMoveType>, InvalidValue> {
43 Ok(self.0.get_int(Tag(841))?.map(DiscretionMoveType::from_value))
44 }
45
46 #[doc(alias = "DiscretionOffsetType")]
48 pub fn discretion_offset_type(&self) -> Result<Option<DiscretionOffsetType>, InvalidValue> {
49 Ok(self.0.get_int(Tag(842))?.map(DiscretionOffsetType::from_value))
50 }
51
52 #[doc(alias = "DiscretionLimitType")]
54 pub fn discretion_limit_type(&self) -> Result<Option<DiscretionLimitType>, InvalidValue> {
55 Ok(self.0.get_int(Tag(843))?.map(DiscretionLimitType::from_value))
56 }
57
58 #[doc(alias = "DiscretionRoundDirection")]
60 pub fn discretion_round_direction(&self) -> Result<Option<DiscretionRoundDirection>, InvalidValue> {
61 Ok(self.0.get_int(Tag(844))?.map(DiscretionRoundDirection::from_value))
62 }
63
64 #[doc(alias = "DiscretionScope")]
66 pub fn discretion_scope(&self) -> Result<Option<DiscretionScope>, InvalidValue> {
67 Ok(self.0.get_int(Tag(846))?.map(DiscretionScope::from_value))
68 }
69}
70
71impl std::fmt::Debug for DiscretionInstructions<'_> {
72 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
73 write!(f, "DiscretionInstructions({})", self.0.display_known(&Self::known_tags().get()))
74 }
75}