Skip to main content

refix_fix44/generated/messages/
security_definition_request.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::{
7    Header, InstrmtLegGrp, Instrument, InstrumentExtension, Trailer, UndInstrmtGrp,
8};
9use super::super::enums::{ExpirationCycle, SecurityRequestType, SubscriptionRequestType};
10
11/// The `SecurityDefinitionRequest` (35=c) message.
12pub struct SecurityDefinitionRequest(RawMessage);
13
14impl SecurityDefinitionRequest {
15    pub const MSG_TYPE: &[u8] = b"c";
16
17    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
18        static TAGS: LazyKnownTags = LazyKnownTags::new(
19            &[
20                Tag(320), Tag(321), Tag(711), Tag(15), Tag(58), Tag(354), Tag(355), Tag(336),
21                Tag(625), Tag(555), Tag(827), Tag(263),
22            ],
23            &[
24                Header::known_tags(), Trailer::known_tags(), Instrument::known_tags(),
25                InstrumentExtension::known_tags(), UndInstrmtGrp::known_tags(),
26                InstrmtLegGrp::known_tags(),
27            ],
28        );
29        &TAGS
30    }
31
32    pub fn from_raw(raw: RawMessage) -> Self {
33        Self(raw)
34    }
35
36    pub fn raw(&self) -> &RawMessage {
37        &self.0
38    }
39
40    pub fn header(&self) -> Header<'_> {
41        Header(self.0.scope(), Self::known_tags().get())
42    }
43
44    pub fn trailer(&self) -> Trailer<'_> {
45        Trailer(self.0.scope())
46    }
47
48    /// The `SecurityReqID` (320) field.
49    #[doc(alias = "SecurityReqID")]
50    pub fn security_req_id(&self) -> Result<Option<&str>, InvalidValue> {
51        self.0.get_str(Tag(320))
52    }
53
54    /// The `SecurityRequestType` (321) field.
55    #[doc(alias = "SecurityRequestType")]
56    pub fn security_request_type(&self) -> Result<Option<SecurityRequestType>, InvalidValue> {
57        Ok(self.0.get_int(Tag(321))?.map(SecurityRequestType::from_value))
58    }
59
60    /// The `Instrument` component.
61    pub fn instrument(&self) -> Instrument<'_> {
62        Instrument(self.0.scope(), Self::known_tags().get())
63    }
64
65    /// The `InstrumentExtension` component.
66    pub fn instrument_extension(&self) -> InstrumentExtension<'_> {
67        InstrumentExtension(self.0.scope(), Self::known_tags().get())
68    }
69
70    /// The instances of the `NoUnderlyings` (711) group.
71    #[doc(alias = "NoUnderlyings")]
72    pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
73        self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
74    }
75
76    /// The `Currency` (15) field.
77    #[doc(alias = "Currency")]
78    pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
79        self.0.get_str(Tag(15))
80    }
81
82    /// The `Text` (58) field.
83    #[doc(alias = "Text")]
84    pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
85        self.0.get_str(Tag(58))
86    }
87
88    /// The `EncodedTextLen` (354) field.
89    #[doc(alias = "EncodedTextLen")]
90    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
91        self.0.get_int(Tag(354))
92    }
93
94    /// The `EncodedText` (355) field.
95    #[doc(alias = "EncodedText")]
96    pub fn encoded_text(&self) -> Option<&[u8]> {
97        self.0.get(Tag(355))
98    }
99
100    /// The `TradingSessionID` (336) field.
101    #[doc(alias = "TradingSessionID")]
102    pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
103        self.0.get_str(Tag(336))
104    }
105
106    /// The `TradingSessionSubID` (625) field.
107    #[doc(alias = "TradingSessionSubID")]
108    pub fn trading_session_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
109        self.0.get_str(Tag(625))
110    }
111
112    /// The instances of the `NoLegs` (555) group.
113    #[doc(alias = "NoLegs")]
114    pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
115        self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
116    }
117
118    /// The `ExpirationCycle` (827) field.
119    #[doc(alias = "ExpirationCycle")]
120    pub fn expiration_cycle(&self) -> Result<Option<ExpirationCycle>, InvalidValue> {
121        Ok(self.0.get_int(Tag(827))?.map(ExpirationCycle::from_value))
122    }
123
124    /// The `SubscriptionRequestType` (263) field.
125    #[doc(alias = "SubscriptionRequestType")]
126    pub fn subscription_request_type(&self) -> Result<Option<SubscriptionRequestType<'_>>, InvalidValue> {
127        Ok(self.0.get_str(Tag(263))?.map(SubscriptionRequestType::from_value))
128    }
129}
130
131impl std::fmt::Debug for SecurityDefinitionRequest {
132    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
133        write!(f, "SecurityDefinitionRequest({})", self.0)
134    }
135}
136
137impl std::fmt::Display for SecurityDefinitionRequest {
138    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
139        std::fmt::Display::fmt(&self.0, f)
140    }
141}