Expand description
The fix_checksum
crate provides functions that
validate FIX message checksum and generate checksum of FIX message.
§Examples
use fix_checksum::{validate, generate};
use fix_checksum::FIXChecksumValidatorError::InvalidEmptyMessage;
// Validator
assert_eq!(validate("").unwrap_err(), InvalidEmptyMessage);
let message_parts: Vec<&str> = vec!["8=FIX.4.2", "9=73", "35=0", "49=BRKR",
"56=INVMGR", "34=235", "52=19980604-07:58:28", "112=19980604-07:58:28", "10=236"];
let mut message: String = message_parts
.iter()
.fold(String::new(), |msg, msg_part| msg.to_string() + msg_part + "\x01");
assert_eq!(validate(&message).unwrap(), true);
// Generator
message = message_parts
.iter()
.take(8)
.fold(String::new(), |msg, msg_part| msg.to_string() + msg_part + "\x01");
assert_eq!("236", generate(&message));
Enums§
Functions§
- This function generates checksum of FIX message
- This function validates FIX message checksum