Expand description
A wide collection of FixValue
implementors.
FIX datatype | Relevant FixValue implementors |
---|---|
int | u32 , i32 , u64 , i64 |
Length | usize |
NumInGroup | usize |
SeqNum | u64 |
TagNum | TagU16 |
DayOfMonth | u32 |
float and float -like | f32 , f64 . rust_decimal::Decimal and decimal::d128 are also supported. |
Boolean | bool |
char | u8 1 |
String | Vec<u8> , &[u8] .1 |
data | Vec<u8> , &[u8] (also String , str for UTF-8 content). |
MultipleCharValue | MultipleChars 1 |
MultipleValueString | MultipleStrings 1 |
Country | Country |
Currency | Currency |
Exchange | Exchange |
month-year | MonthYear |
UTCTimestamp | Timestamp |
LocalMktDate | Timestamp |
UTCTimeOnly | Time |
TZTimestamp | TzTimestamp |
TZTimeOnly | TzTime |
UTCDateOnly | Date |
§Quick tour of FixValue
use fefix::FixValue;
use fefix::fix_values::Timestamp;
let bytes = b"20130422-12:30:00.000";
// You can use `FixValue::deserialize` to parse data fields.
let timestamp = Timestamp::deserialize(bytes).unwrap();
assert_eq!(timestamp.date().year(), 2013);
// `FixValue::deserialize_lossy` is like `FixValue::deserialize`, but it's
// allowed to skip some format verification for the sake of speed.
assert!(u32::deserialize(b"invalid integer").is_err());
assert!(u32::deserialize_lossy(b"invalid integer").is_ok());
let mut buffer: Vec<u8> = vec![];
// Use `FixValue::serialize` to write values to buffers.
1337u32.serialize(&mut buffer);
assert_eq!(&buffer[..], b"1337" as &[u8]);
With the exception of datatype
data
, FIX mandates a single-byte encoding (Latin alphabet No. 1 by default), while Rust strings are UTF-8, which is a multibyte. These are not compatible. Watch out! ↩
Structs§
- Check
Sum - The result of a FIX checksum calculation (0-255).
- Date
- Representation for
LocalMktDate
and andUTCDateOnly
inYYYYMMDD
format. - Month
Year - Canonical data field (DTF) for
FixDatatype::MonthYear
. - Multiple
Chars - An
Iterator
over space-delimited bytes in aMultipleCharValue
FIX field. - Multiple
Strings - An
Iterator
over space-delimited byte sequences in aMultipleStringValue
FIX field. - Time
- Canonical data field (DTF) for
FixDatatype::UtcTimeOnly
. - Timestamp
- Representation for
UtcTimestamp
. - Tz
- Timezone indicator.
- TzTime
- Timezone-aware intra-day timestamp.
- TzTimestamp
- A time and date combination representing local time with an offset from UTC.
- Zero
Padding - Zero-padding for integers; see
FixValue::SerializeSettings
.
Functions§
- test_
utility_ verify_ serialization_ behavior - Tries to
FixValue::serialize
anitem
, then toFixValue::deserialize
it, and finally checks for equality with the initial data.FixValue::deserialize_lossy
is then tested in the same manner.