Skip to main content

refix_fix44/generated/messages/
derivative_security_list.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};
5
6use super::super::components::{Header, RelSymDerivSecGrp, Trailer, UnderlyingInstrument};
7use super::super::enums::SecurityRequestResult;
8
9/// The `DerivativeSecurityList` (35=AA) message.
10pub struct DerivativeSecurityList(RawMessage);
11
12impl DerivativeSecurityList {
13    pub const MSG_TYPE: &[u8] = b"AA";
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            &[
19                Header::known_tags(), Trailer::known_tags(), UnderlyingInstrument::known_tags(),
20                RelSymDerivSecGrp::known_tags(),
21            ],
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    /// The `SecurityReqID` (320) field.
43    #[doc(alias = "SecurityReqID")]
44    pub fn security_req_id(&self) -> Result<Option<&str>, InvalidValue> {
45        self.0.get_str(Tag(320))
46    }
47
48    /// The `SecurityResponseID` (322) field.
49    #[doc(alias = "SecurityResponseID")]
50    pub fn security_response_id(&self) -> Result<Option<&str>, InvalidValue> {
51        self.0.get_str(Tag(322))
52    }
53
54    /// The `SecurityRequestResult` (560) field.
55    #[doc(alias = "SecurityRequestResult")]
56    pub fn security_request_result(&self) -> Result<Option<SecurityRequestResult>, InvalidValue> {
57        Ok(self.0.get_int(Tag(560))?.map(SecurityRequestResult::from_value))
58    }
59
60    /// The `UnderlyingInstrument` component.
61    pub fn underlying_instrument(&self) -> UnderlyingInstrument<'_> {
62        UnderlyingInstrument(self.0.scope(), Self::known_tags().get())
63    }
64
65    /// The `TotNoRelatedSym` (393) field.
66    #[doc(alias = "TotNoRelatedSym")]
67    pub fn tot_no_related_sym(&self) -> Result<Option<i64>, InvalidValue> {
68        self.0.get_int(Tag(393))
69    }
70
71    /// The `LastFragment` (893) field.
72    #[doc(alias = "LastFragment")]
73    pub fn last_fragment(&self) -> Result<Option<bool>, InvalidValue> {
74        self.0.get_bool(Tag(893))
75    }
76
77    /// The instances of the `NoRelatedSym` (146) group.
78    #[doc(alias = "NoRelatedSym")]
79    pub fn related_sym(&self) -> Result<Instances<'_, RelSymDerivSecGrp<'_>>, InvalidValue> {
80        self.0.get_group(&RelSymDerivSecGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
81    }
82}
83
84impl std::fmt::Debug for DerivativeSecurityList {
85    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
86        write!(f, "DerivativeSecurityList({})", self.0)
87    }
88}
89
90impl std::fmt::Display for DerivativeSecurityList {
91    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
92        std::fmt::Display::fmt(&self.0, f)
93    }
94}