Skip to main content

refix_fix42/generated/messages/
heartbeat.rs

1// @generated by refix codegen from FIX42.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{InvalidValue, RawMessage, Tag};
5
6use super::super::components::{Header, Trailer};
7
8/// The `Heartbeat` (35=0) message.
9pub struct Heartbeat(RawMessage);
10
11impl Heartbeat {
12    pub const MSG_TYPE: &[u8] = b"0";
13
14    pub fn from_raw(raw: RawMessage) -> Self {
15        Self(raw)
16    }
17
18    pub fn raw(&self) -> &RawMessage {
19        &self.0
20    }
21
22    pub fn header(&self) -> Header<'_> {
23        Header(self.0.scope())
24    }
25
26    pub fn trailer(&self) -> Trailer<'_> {
27        Trailer(self.0.scope())
28    }
29
30    /// The `TestReqID` (112) field.
31    #[doc(alias = "TestReqID")]
32    pub fn test_req_id(&self) -> Result<Option<&str>, InvalidValue> {
33        self.0.get_str(Tag(112))
34    }
35}
36
37impl std::fmt::Debug for Heartbeat {
38    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39        write!(f, "Heartbeat({})", self.0)
40    }
41}
42
43impl std::fmt::Display for Heartbeat {
44    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
45        std::fmt::Display::fmt(&self.0, f)
46    }
47}