refix_fix44/generated/messages/
security_definition_request.rs1#![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
11pub 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 #[doc(alias = "SecurityReqID")]
50 pub fn security_req_id(&self) -> Result<Option<&str>, InvalidValue> {
51 self.0.get_str(Tag(320))
52 }
53
54 #[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 pub fn instrument(&self) -> Instrument<'_> {
62 Instrument(self.0.scope(), Self::known_tags().get())
63 }
64
65 pub fn instrument_extension(&self) -> InstrumentExtension<'_> {
67 InstrumentExtension(self.0.scope(), Self::known_tags().get())
68 }
69
70 #[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 #[doc(alias = "Currency")]
78 pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
79 self.0.get_str(Tag(15))
80 }
81
82 #[doc(alias = "Text")]
84 pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
85 self.0.get_str(Tag(58))
86 }
87
88 #[doc(alias = "EncodedTextLen")]
90 pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
91 self.0.get_int(Tag(354))
92 }
93
94 #[doc(alias = "EncodedText")]
96 pub fn encoded_text(&self) -> Option<&[u8]> {
97 self.0.get(Tag(355))
98 }
99
100 #[doc(alias = "TradingSessionID")]
102 pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
103 self.0.get_str(Tag(336))
104 }
105
106 #[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 #[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 #[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 #[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}