refix_message/tag.rs
1/// A FIX tag number, e.g. `Tag(35)` for MsgType.
2#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
3pub struct Tag(pub u32);
4
5impl Tag {
6 /// Tag recorded for a run of bytes that could not be tokenised into a field.
7 pub const MALFORMED: Tag = Tag(0);
8}
9
10impl std::fmt::Display for Tag {
11 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12 write!(f, "{}", self.0)
13 }
14}
15
16#[cfg(test)]
17mod tests {
18 use super::*;
19
20 #[test]
21 fn displays_as_the_bare_number() {
22 assert_eq!(Tag(35).to_string(), "35");
23 }
24}