refix_fix44/generated/messages/
allocation_report_ack.rs1#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Date, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag, UtcTimestamp};
5
6use super::super::components::{AllocAckGrp, Header, Parties, Trailer};
7use super::super::enums::{
8 AllocIntermedReqType, AllocRejCode, AllocReportType, AllocStatus, MatchStatus, Product,
9 SecurityType,
10};
11
12pub struct AllocationReportAck(RawMessage);
14
15impl AllocationReportAck {
16 pub const MSG_TYPE: &[u8] = b"AT";
17
18 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
19 static TAGS: LazyKnownTags = LazyKnownTags::new(
20 &[
21 Tag(755), Tag(70), Tag(453), Tag(793), Tag(75), Tag(60), Tag(87), Tag(88), Tag(794),
22 Tag(808), Tag(573), Tag(460), Tag(167), Tag(58), Tag(354), Tag(355), Tag(78),
23 ],
24 &[
25 Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
26 AllocAckGrp::known_tags(),
27 ],
28 );
29 &TAGS
30 }
31
32 pub fn from_raw(raw: RawMessage) -> Self {
33 Self(raw)
34 }
35
36 pub fn raw(&self) -> &RawMessage {
37 &self.0
38 }
39
40 pub fn header(&self) -> Header<'_> {
41 Header(self.0.scope(), Self::known_tags().get())
42 }
43
44 pub fn trailer(&self) -> Trailer<'_> {
45 Trailer(self.0.scope())
46 }
47
48 #[doc(alias = "AllocReportID")]
50 pub fn alloc_report_id(&self) -> Result<Option<&str>, InvalidValue> {
51 self.0.get_str(Tag(755))
52 }
53
54 #[doc(alias = "AllocID")]
56 pub fn alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
57 self.0.get_str(Tag(70))
58 }
59
60 #[doc(alias = "NoPartyIDs")]
62 pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
63 self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
64 }
65
66 #[doc(alias = "SecondaryAllocID")]
68 pub fn secondary_alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
69 self.0.get_str(Tag(793))
70 }
71
72 #[doc(alias = "TradeDate")]
74 pub fn trade_date(&self) -> Result<Option<Date>, InvalidValue> {
75 self.0.get_date(Tag(75))
76 }
77
78 #[doc(alias = "TransactTime")]
80 pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
81 self.0.get_utc_timestamp(Tag(60))
82 }
83
84 #[doc(alias = "AllocStatus")]
86 pub fn alloc_status(&self) -> Result<Option<AllocStatus>, InvalidValue> {
87 Ok(self.0.get_int(Tag(87))?.map(AllocStatus::from_value))
88 }
89
90 #[doc(alias = "AllocRejCode")]
92 pub fn alloc_rej_code(&self) -> Result<Option<AllocRejCode>, InvalidValue> {
93 Ok(self.0.get_int(Tag(88))?.map(AllocRejCode::from_value))
94 }
95
96 #[doc(alias = "AllocReportType")]
98 pub fn alloc_report_type(&self) -> Result<Option<AllocReportType>, InvalidValue> {
99 Ok(self.0.get_int(Tag(794))?.map(AllocReportType::from_value))
100 }
101
102 #[doc(alias = "AllocIntermedReqType")]
104 pub fn alloc_intermed_req_type(&self) -> Result<Option<AllocIntermedReqType>, InvalidValue> {
105 Ok(self.0.get_int(Tag(808))?.map(AllocIntermedReqType::from_value))
106 }
107
108 #[doc(alias = "MatchStatus")]
110 pub fn match_status(&self) -> Result<Option<MatchStatus<'_>>, InvalidValue> {
111 Ok(self.0.get_str(Tag(573))?.map(MatchStatus::from_value))
112 }
113
114 #[doc(alias = "Product")]
116 pub fn product(&self) -> Result<Option<Product>, InvalidValue> {
117 Ok(self.0.get_int(Tag(460))?.map(Product::from_value))
118 }
119
120 #[doc(alias = "SecurityType")]
122 pub fn security_type(&self) -> Result<Option<SecurityType<'_>>, InvalidValue> {
123 Ok(self.0.get_str(Tag(167))?.map(SecurityType::from_value))
124 }
125
126 #[doc(alias = "Text")]
128 pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
129 self.0.get_str(Tag(58))
130 }
131
132 #[doc(alias = "EncodedTextLen")]
134 pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
135 self.0.get_int(Tag(354))
136 }
137
138 #[doc(alias = "EncodedText")]
140 pub fn encoded_text(&self) -> Option<&[u8]> {
141 self.0.get(Tag(355))
142 }
143
144 #[doc(alias = "NoAllocs")]
146 pub fn allocs(&self) -> Result<Instances<'_, AllocAckGrp<'_>>, InvalidValue> {
147 self.0.get_group(&AllocAckGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
148 }
149}
150
151impl std::fmt::Debug for AllocationReportAck {
152 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
153 write!(f, "AllocationReportAck({})", self.0)
154 }
155}
156
157impl std::fmt::Display for AllocationReportAck {
158 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
159 std::fmt::Display::fmt(&self.0, f)
160 }
161}