forgefix/fix/generated/
mod.rs1mod fields;
4pub use fields::*;
5impl MsgType {
6 pub fn is_session(&self) -> bool {
7 matches!(
8 self,
9 MsgType::HEARTBEAT
10 | MsgType::TEST_REQUEST
11 | MsgType::RESEND_REQUEST
12 | MsgType::REJECT
13 | MsgType::SEQUENCE_RESET
14 | MsgType::LOGOUT
15 | MsgType::LOGON
16 )
17 }
18 pub fn is_application(&self) -> bool {
19 !self.is_session()
20 }
21}
22
23#[allow(clippy::from_over_into)]
24impl Into<u32> for &SessionRejectReason {
25 fn into(self) -> u32 {
26 match *self {
27 SessionRejectReason::INVALID_TAG_NUMBER => 0,
28 SessionRejectReason::REQUIRED_TAG_MISSING => 1,
29 SessionRejectReason::SENDINGTIME_ACCURACY_PROBLEM => 10,
30 SessionRejectReason::INVALID_MSGTYPE => 11,
31 SessionRejectReason::TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE => 2,
32 SessionRejectReason::UNDEFINED_TAG => 3,
33 SessionRejectReason::TAG_SPECIFIED_WITHOUT_A_VALUE => 4,
34 SessionRejectReason::VALUE_IS_INCORRECT => 5,
35 SessionRejectReason::INCORRECT_DATA_FORMAT_FOR_VALUE => 6,
36 SessionRejectReason::DECRYPTION_PROBLEM => 7,
37 SessionRejectReason::SIGNATURE_PROBLEM => 8,
38 SessionRejectReason::COMPID_PROBLEM => 9,
39 }
40 }
41}
42
43#[allow(clippy::from_over_into)]
44impl Into<String> for &SessionRejectReason {
45 fn into(self) -> String {
46 match *self {
47 SessionRejectReason::INVALID_TAG_NUMBER => String::from("Invalid tag number"),
48 SessionRejectReason::REQUIRED_TAG_MISSING => String::from("Required tag missing"),
49 SessionRejectReason::SENDINGTIME_ACCURACY_PROBLEM => {
50 String::from("SendingTime accuracy problem")
51 }
52 SessionRejectReason::INVALID_MSGTYPE => String::from("Invalid MsgType"),
53 SessionRejectReason::TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE => {
54 String::from("Tag not defined for this message type")
55 }
56 SessionRejectReason::UNDEFINED_TAG => String::from("Undefined tag"),
57 SessionRejectReason::TAG_SPECIFIED_WITHOUT_A_VALUE => {
58 String::from("Tag specified without a value")
59 }
60 SessionRejectReason::VALUE_IS_INCORRECT => String::from("Value is incorrect"),
61 SessionRejectReason::INCORRECT_DATA_FORMAT_FOR_VALUE => {
62 String::from("Incorrect data format for value")
63 }
64 SessionRejectReason::DECRYPTION_PROBLEM => String::from("Decryption problem"),
65 SessionRejectReason::SIGNATURE_PROBLEM => String::from("Signature problem"),
66 SessionRejectReason::COMPID_PROBLEM => String::from("CompID problem"),
67 }
68 }
69}