refix_fix44/generated/messages/
heartbeat.rs1#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{InvalidValue, LazyKnownTags, RawMessage, Tag};
5
6use super::super::components::{Header, Trailer};
7
8pub struct Heartbeat(RawMessage);
10
11impl Heartbeat {
12 pub const MSG_TYPE: &[u8] = b"0";
13
14 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
15 static TAGS: LazyKnownTags = LazyKnownTags::new(
16 &[Tag(112)],
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 #[doc(alias = "TestReqID")]
40 pub fn test_req_id(&self) -> Result<Option<&str>, InvalidValue> {
41 self.0.get_str(Tag(112))
42 }
43}
44
45impl std::fmt::Debug for Heartbeat {
46 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
47 write!(f, "Heartbeat({})", self.0)
48 }
49}
50
51impl std::fmt::Display for Heartbeat {
52 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
53 std::fmt::Display::fmt(&self.0, f)
54 }
55}