refix_fix44/generated/messages/
allocation_instruction_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, AllocStatus, AllocType, MatchStatus, Product, SecurityType,
9};
10
11pub struct AllocationInstructionAck(RawMessage);
13
14impl AllocationInstructionAck {
15 pub const MSG_TYPE: &[u8] = b"P";
16
17 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
18 static TAGS: LazyKnownTags = LazyKnownTags::new(
19 &[
20 Tag(70), Tag(453), Tag(793), Tag(75), Tag(60), Tag(87), Tag(88), Tag(626), Tag(808),
21 Tag(573), Tag(460), Tag(167), Tag(58), Tag(354), Tag(355), Tag(78),
22 ],
23 &[
24 Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
25 AllocAckGrp::known_tags(),
26 ],
27 );
28 &TAGS
29 }
30
31 pub fn from_raw(raw: RawMessage) -> Self {
32 Self(raw)
33 }
34
35 pub fn raw(&self) -> &RawMessage {
36 &self.0
37 }
38
39 pub fn header(&self) -> Header<'_> {
40 Header(self.0.scope(), Self::known_tags().get())
41 }
42
43 pub fn trailer(&self) -> Trailer<'_> {
44 Trailer(self.0.scope())
45 }
46
47 #[doc(alias = "AllocID")]
49 pub fn alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
50 self.0.get_str(Tag(70))
51 }
52
53 #[doc(alias = "NoPartyIDs")]
55 pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
56 self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
57 }
58
59 #[doc(alias = "SecondaryAllocID")]
61 pub fn secondary_alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
62 self.0.get_str(Tag(793))
63 }
64
65 #[doc(alias = "TradeDate")]
67 pub fn trade_date(&self) -> Result<Option<Date>, InvalidValue> {
68 self.0.get_date(Tag(75))
69 }
70
71 #[doc(alias = "TransactTime")]
73 pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
74 self.0.get_utc_timestamp(Tag(60))
75 }
76
77 #[doc(alias = "AllocStatus")]
79 pub fn alloc_status(&self) -> Result<Option<AllocStatus>, InvalidValue> {
80 Ok(self.0.get_int(Tag(87))?.map(AllocStatus::from_value))
81 }
82
83 #[doc(alias = "AllocRejCode")]
85 pub fn alloc_rej_code(&self) -> Result<Option<AllocRejCode>, InvalidValue> {
86 Ok(self.0.get_int(Tag(88))?.map(AllocRejCode::from_value))
87 }
88
89 #[doc(alias = "AllocType")]
91 pub fn alloc_type(&self) -> Result<Option<AllocType>, InvalidValue> {
92 Ok(self.0.get_int(Tag(626))?.map(AllocType::from_value))
93 }
94
95 #[doc(alias = "AllocIntermedReqType")]
97 pub fn alloc_intermed_req_type(&self) -> Result<Option<AllocIntermedReqType>, InvalidValue> {
98 Ok(self.0.get_int(Tag(808))?.map(AllocIntermedReqType::from_value))
99 }
100
101 #[doc(alias = "MatchStatus")]
103 pub fn match_status(&self) -> Result<Option<MatchStatus<'_>>, InvalidValue> {
104 Ok(self.0.get_str(Tag(573))?.map(MatchStatus::from_value))
105 }
106
107 #[doc(alias = "Product")]
109 pub fn product(&self) -> Result<Option<Product>, InvalidValue> {
110 Ok(self.0.get_int(Tag(460))?.map(Product::from_value))
111 }
112
113 #[doc(alias = "SecurityType")]
115 pub fn security_type(&self) -> Result<Option<SecurityType<'_>>, InvalidValue> {
116 Ok(self.0.get_str(Tag(167))?.map(SecurityType::from_value))
117 }
118
119 #[doc(alias = "Text")]
121 pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
122 self.0.get_str(Tag(58))
123 }
124
125 #[doc(alias = "EncodedTextLen")]
127 pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
128 self.0.get_int(Tag(354))
129 }
130
131 #[doc(alias = "EncodedText")]
133 pub fn encoded_text(&self) -> Option<&[u8]> {
134 self.0.get(Tag(355))
135 }
136
137 #[doc(alias = "NoAllocs")]
139 pub fn allocs(&self) -> Result<Instances<'_, AllocAckGrp<'_>>, InvalidValue> {
140 self.0.get_group(&AllocAckGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
141 }
142}
143
144impl std::fmt::Debug for AllocationInstructionAck {
145 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
146 write!(f, "AllocationInstructionAck({})", self.0)
147 }
148}
149
150impl std::fmt::Display for AllocationInstructionAck {
151 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
152 std::fmt::Display::fmt(&self.0, f)
153 }
154}