refix_fix44/generated/messages/
security_list.rs1#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};
5
6use super::super::components::{Header, SecListGrp, Trailer};
7use super::super::enums::SecurityRequestResult;
8
9pub struct SecurityList(RawMessage);
11
12impl SecurityList {
13 pub const MSG_TYPE: &[u8] = b"y";
14
15 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
16 static TAGS: LazyKnownTags = LazyKnownTags::new(
17 &[Tag(320), Tag(322), Tag(560), Tag(393), Tag(893), Tag(146)],
18 &[Header::known_tags(), Trailer::known_tags(), SecListGrp::known_tags()],
19 );
20 &TAGS
21 }
22
23 pub fn from_raw(raw: RawMessage) -> Self {
24 Self(raw)
25 }
26
27 pub fn raw(&self) -> &RawMessage {
28 &self.0
29 }
30
31 pub fn header(&self) -> Header<'_> {
32 Header(self.0.scope(), Self::known_tags().get())
33 }
34
35 pub fn trailer(&self) -> Trailer<'_> {
36 Trailer(self.0.scope())
37 }
38
39 #[doc(alias = "SecurityReqID")]
41 pub fn security_req_id(&self) -> Result<Option<&str>, InvalidValue> {
42 self.0.get_str(Tag(320))
43 }
44
45 #[doc(alias = "SecurityResponseID")]
47 pub fn security_response_id(&self) -> Result<Option<&str>, InvalidValue> {
48 self.0.get_str(Tag(322))
49 }
50
51 #[doc(alias = "SecurityRequestResult")]
53 pub fn security_request_result(&self) -> Result<Option<SecurityRequestResult>, InvalidValue> {
54 Ok(self.0.get_int(Tag(560))?.map(SecurityRequestResult::from_value))
55 }
56
57 #[doc(alias = "TotNoRelatedSym")]
59 pub fn tot_no_related_sym(&self) -> Result<Option<i64>, InvalidValue> {
60 self.0.get_int(Tag(393))
61 }
62
63 #[doc(alias = "LastFragment")]
65 pub fn last_fragment(&self) -> Result<Option<bool>, InvalidValue> {
66 self.0.get_bool(Tag(893))
67 }
68
69 #[doc(alias = "NoRelatedSym")]
71 pub fn related_sym(&self) -> Result<Instances<'_, SecListGrp<'_>>, InvalidValue> {
72 self.0.get_group(&SecListGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
73 }
74}
75
76impl std::fmt::Debug for SecurityList {
77 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
78 write!(f, "SecurityList({})", self.0)
79 }
80}
81
82impl std::fmt::Display for SecurityList {
83 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
84 std::fmt::Display::fmt(&self.0, f)
85 }
86}