Skip to main content

refix_fix42/generated/messages/
allocation_instruction_ack.rs

1// @generated by refix codegen from FIX42.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Date, InvalidValue, RawMessage, Tag, UtcTimestamp};
5
6use super::super::components::{Header, Trailer};
7use super::super::enums::{AllocRejCode, AllocStatus};
8
9/// The `AllocationInstructionAck` (35=P) message.
10pub struct AllocationInstructionAck(RawMessage);
11
12impl AllocationInstructionAck {
13    pub const MSG_TYPE: &[u8] = b"P";
14
15    pub fn from_raw(raw: RawMessage) -> Self {
16        Self(raw)
17    }
18
19    pub fn raw(&self) -> &RawMessage {
20        &self.0
21    }
22
23    pub fn header(&self) -> Header<'_> {
24        Header(self.0.scope())
25    }
26
27    pub fn trailer(&self) -> Trailer<'_> {
28        Trailer(self.0.scope())
29    }
30
31    /// The `ClientID` (109) field.
32    #[doc(alias = "ClientID")]
33    pub fn client_id(&self) -> Result<Option<&str>, InvalidValue> {
34        self.0.get_str(Tag(109))
35    }
36
37    /// The `ExecBroker` (76) field.
38    #[doc(alias = "ExecBroker")]
39    pub fn exec_broker(&self) -> Result<Option<&str>, InvalidValue> {
40        self.0.get_str(Tag(76))
41    }
42
43    /// The `AllocID` (70) field.
44    #[doc(alias = "AllocID")]
45    pub fn alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
46        self.0.get_str(Tag(70))
47    }
48
49    /// The `TradeDate` (75) field.
50    #[doc(alias = "TradeDate")]
51    pub fn trade_date(&self) -> Result<Option<Date>, InvalidValue> {
52        self.0.get_date(Tag(75))
53    }
54
55    /// The `TransactTime` (60) field.
56    #[doc(alias = "TransactTime")]
57    pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
58        self.0.get_utc_timestamp(Tag(60))
59    }
60
61    /// The `AllocStatus` (87) field.
62    #[doc(alias = "AllocStatus")]
63    pub fn alloc_status(&self) -> Result<Option<AllocStatus>, InvalidValue> {
64        Ok(self.0.get_int(Tag(87))?.map(AllocStatus::from_value))
65    }
66
67    /// The `AllocRejCode` (88) field.
68    #[doc(alias = "AllocRejCode")]
69    pub fn alloc_rej_code(&self) -> Result<Option<AllocRejCode>, InvalidValue> {
70        Ok(self.0.get_int(Tag(88))?.map(AllocRejCode::from_value))
71    }
72
73    /// The `Text` (58) field.
74    #[doc(alias = "Text")]
75    pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
76        self.0.get_str(Tag(58))
77    }
78
79    /// The `EncodedTextLen` (354) field.
80    #[doc(alias = "EncodedTextLen")]
81    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
82        self.0.get_int(Tag(354))
83    }
84
85    /// The `EncodedText` (355) field.
86    #[doc(alias = "EncodedText")]
87    pub fn encoded_text(&self) -> Option<&[u8]> {
88        self.0.get(Tag(355))
89    }
90}
91
92impl std::fmt::Debug for AllocationInstructionAck {
93    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
94        write!(f, "AllocationInstructionAck({})", self.0)
95    }
96}
97
98impl std::fmt::Display for AllocationInstructionAck {
99    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
100        std::fmt::Display::fmt(&self.0, f)
101    }
102}