refix_fix44/generated/messages/
settlement_instructions.rs1#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag, UtcTimestamp};
5
6use super::super::components::{Header, SettlInstGrp, Trailer};
7use super::super::enums::{SettlInstMode, SettlInstReqRejCode};
8
9pub struct SettlementInstructions(RawMessage);
11
12impl SettlementInstructions {
13 pub const MSG_TYPE: &[u8] = b"T";
14
15 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
16 static TAGS: LazyKnownTags = LazyKnownTags::new(
17 &[
18 Tag(777), Tag(791), Tag(160), Tag(792), Tag(58), Tag(354), Tag(355), Tag(11),
19 Tag(60), Tag(778),
20 ],
21 &[Header::known_tags(), Trailer::known_tags(), SettlInstGrp::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 = "SettlInstMsgID")]
44 pub fn settl_inst_msg_id(&self) -> Result<Option<&str>, InvalidValue> {
45 self.0.get_str(Tag(777))
46 }
47
48 #[doc(alias = "SettlInstReqID")]
50 pub fn settl_inst_req_id(&self) -> Result<Option<&str>, InvalidValue> {
51 self.0.get_str(Tag(791))
52 }
53
54 #[doc(alias = "SettlInstMode")]
56 pub fn settl_inst_mode(&self) -> Result<Option<SettlInstMode<'_>>, InvalidValue> {
57 Ok(self.0.get_str(Tag(160))?.map(SettlInstMode::from_value))
58 }
59
60 #[doc(alias = "SettlInstReqRejCode")]
62 pub fn settl_inst_req_rej_code(&self) -> Result<Option<SettlInstReqRejCode>, InvalidValue> {
63 Ok(self.0.get_int(Tag(792))?.map(SettlInstReqRejCode::from_value))
64 }
65
66 #[doc(alias = "Text")]
68 pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
69 self.0.get_str(Tag(58))
70 }
71
72 #[doc(alias = "EncodedTextLen")]
74 pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
75 self.0.get_int(Tag(354))
76 }
77
78 #[doc(alias = "EncodedText")]
80 pub fn encoded_text(&self) -> Option<&[u8]> {
81 self.0.get(Tag(355))
82 }
83
84 #[doc(alias = "ClOrdID")]
86 pub fn cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
87 self.0.get_str(Tag(11))
88 }
89
90 #[doc(alias = "TransactTime")]
92 pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
93 self.0.get_utc_timestamp(Tag(60))
94 }
95
96 #[doc(alias = "NoSettlInst")]
98 pub fn settl_inst(&self) -> Result<Instances<'_, SettlInstGrp<'_>>, InvalidValue> {
99 self.0.get_group(&SettlInstGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
100 }
101}
102
103impl std::fmt::Debug for SettlementInstructions {
104 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
105 write!(f, "SettlementInstructions({})", self.0)
106 }
107}
108
109impl std::fmt::Display for SettlementInstructions {
110 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
111 std::fmt::Display::fmt(&self.0, f)
112 }
113}