Skip to main content

refix_fix44/generated/messages/
logout.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{InvalidValue, LazyKnownTags, RawMessage, Tag};
5
6use super::super::components::{Header, Trailer};
7
8/// The `Logout` (35=5) message.
9pub struct Logout(RawMessage);
10
11impl Logout {
12    pub const MSG_TYPE: &[u8] = b"5";
13
14    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
15        static TAGS: LazyKnownTags = LazyKnownTags::new(
16            &[Tag(58), Tag(354), Tag(355)],
17            &[Header::known_tags(), Trailer::known_tags()],
18        );
19        &TAGS
20    }
21
22    pub fn from_raw(raw: RawMessage) -> Self {
23        Self(raw)
24    }
25
26    pub fn raw(&self) -> &RawMessage {
27        &self.0
28    }
29
30    pub fn header(&self) -> Header<'_> {
31        Header(self.0.scope(), Self::known_tags().get())
32    }
33
34    pub fn trailer(&self) -> Trailer<'_> {
35        Trailer(self.0.scope())
36    }
37
38    /// The `Text` (58) field.
39    #[doc(alias = "Text")]
40    pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
41        self.0.get_str(Tag(58))
42    }
43
44    /// The `EncodedTextLen` (354) field.
45    #[doc(alias = "EncodedTextLen")]
46    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
47        self.0.get_int(Tag(354))
48    }
49
50    /// The `EncodedText` (355) field.
51    #[doc(alias = "EncodedText")]
52    pub fn encoded_text(&self) -> Option<&[u8]> {
53        self.0.get(Tag(355))
54    }
55}
56
57impl std::fmt::Debug for Logout {
58    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
59        write!(f, "Logout({})", self.0)
60    }
61}
62
63impl std::fmt::Display for Logout {
64    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
65        std::fmt::Display::fmt(&self.0, f)
66    }
67}