refix_fix44/generated/messages/
confirmation_request.rs1#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag, UtcTimestamp};
5
6use super::super::components::{Header, OrdAllocGrp, Trailer};
7use super::super::enums::{AllocAccountType, ConfirmType};
8
9pub struct ConfirmationRequest(RawMessage);
11
12impl ConfirmationRequest {
13 pub const MSG_TYPE: &[u8] = b"BH";
14
15 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
16 static TAGS: LazyKnownTags = LazyKnownTags::new(
17 &[
18 Tag(859), Tag(773), Tag(73), Tag(70), Tag(793), Tag(467), Tag(60), Tag(79),
19 Tag(661), Tag(798), Tag(58), Tag(354), Tag(355),
20 ],
21 &[Header::known_tags(), Trailer::known_tags(), OrdAllocGrp::known_tags()],
22 );
23 &TAGS
24 }
25
26 pub fn from_raw(raw: RawMessage) -> Self {
27 Self(raw)
28 }
29
30 pub fn raw(&self) -> &RawMessage {
31 &self.0
32 }
33
34 pub fn header(&self) -> Header<'_> {
35 Header(self.0.scope(), Self::known_tags().get())
36 }
37
38 pub fn trailer(&self) -> Trailer<'_> {
39 Trailer(self.0.scope())
40 }
41
42 #[doc(alias = "ConfirmReqID")]
44 pub fn confirm_req_id(&self) -> Result<Option<&str>, InvalidValue> {
45 self.0.get_str(Tag(859))
46 }
47
48 #[doc(alias = "ConfirmType")]
50 pub fn confirm_type(&self) -> Result<Option<ConfirmType>, InvalidValue> {
51 Ok(self.0.get_int(Tag(773))?.map(ConfirmType::from_value))
52 }
53
54 #[doc(alias = "NoOrders")]
56 pub fn orders(&self) -> Result<Instances<'_, OrdAllocGrp<'_>>, InvalidValue> {
57 self.0.get_group(&OrdAllocGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
58 }
59
60 #[doc(alias = "AllocID")]
62 pub fn alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
63 self.0.get_str(Tag(70))
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 = "IndividualAllocID")]
74 pub fn individual_alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
75 self.0.get_str(Tag(467))
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 = "AllocAccount")]
86 pub fn alloc_account(&self) -> Result<Option<&str>, InvalidValue> {
87 self.0.get_str(Tag(79))
88 }
89
90 #[doc(alias = "AllocAcctIDSource")]
92 pub fn alloc_acct_id_source(&self) -> Result<Option<i64>, InvalidValue> {
93 self.0.get_int(Tag(661))
94 }
95
96 #[doc(alias = "AllocAccountType")]
98 pub fn alloc_account_type(&self) -> Result<Option<AllocAccountType>, InvalidValue> {
99 Ok(self.0.get_int(Tag(798))?.map(AllocAccountType::from_value))
100 }
101
102 #[doc(alias = "Text")]
104 pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
105 self.0.get_str(Tag(58))
106 }
107
108 #[doc(alias = "EncodedTextLen")]
110 pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
111 self.0.get_int(Tag(354))
112 }
113
114 #[doc(alias = "EncodedText")]
116 pub fn encoded_text(&self) -> Option<&[u8]> {
117 self.0.get(Tag(355))
118 }
119}
120
121impl std::fmt::Debug for ConfirmationRequest {
122 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
123 write!(f, "ConfirmationRequest({})", self.0)
124 }
125}
126
127impl std::fmt::Display for ConfirmationRequest {
128 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
129 std::fmt::Display::fmt(&self.0, f)
130 }
131}