hotfix_encoding/
definitions.rs

1//! Field and message definitions for all FIX application versions.
2//!
3//! # What is this and why is this necessary?
4//!
5//! FerrumFIX internals rely on [`Dictionary`](crate::Dictionary) for accessing
6//! details about fields, messages and other abstract entities defined in the
7//! FIX Dictionary specifications. Although this approach works quite well, it
8//! can become daunting to query a [`Dictionary`](crate::Dictionary) for even
9//! the most basic operation.
10
11use crate::dict::FixDatatype;
12use crate::{dict, TagU32};
13
14#[derive(Debug, Clone)]
15#[doc(hidden)]
16pub struct HardCodedFixFieldDefinition {
17    pub name: &'static str,
18    pub tag: u32,
19    pub data_type: FixDatatype,
20    pub location: dict::FieldLocation,
21}
22
23impl dict::IsFieldDefinition for HardCodedFixFieldDefinition {
24    #[inline]
25    fn tag(&self) -> TagU32 {
26        TagU32::new(self.tag).expect("Invalid tag number 0.")
27    }
28
29    #[inline]
30    fn name(&self) -> &str {
31        self.name
32    }
33
34    #[inline]
35    fn location(&self) -> dict::FieldLocation {
36        self.location
37    }
38}
39
40#[cfg(feature = "fix42")]
41#[allow(dead_code, unused, warnings)]
42#[rustfmt::skip]
43/// Field and message definitions for FIX.4.4.
44pub mod fix42 {
45    include!(concat!(env!("OUT_DIR"), "/fix42.rs"));
46}
47
48#[allow(dead_code, unused, warnings)]
49#[rustfmt::skip]
50/// Field and message definitions for FIX.4.4.
51pub mod fix44 {
52    include!(concat!(env!("OUT_DIR"), "/fix44.rs"));
53}