Module fix_values

Source
Expand description

A wide collection of FixValue implementors.

FIX datatypeRelevant FixValue implementors
intu32, i32, u64, i64
Lengthusize
NumInGroupusize
SeqNumu64
TagNumTagU16
DayOfMonthu32
float and float -likef32, f64. rust_decimal::Decimal and decimal::d128 are also supported.
Booleanbool
charu8 1
StringVec<u8>, &[u8].1
dataVec<u8>, &[u8] (also String, str for UTF-8 content).
MultipleCharValueMultipleChars 1
MultipleValueStringMultipleStrings 1
CountryCountry
CurrencyCurrency
ExchangeExchange
month-yearMonthYear
UTCTimestampTimestamp
LocalMktDateTimestamp
UTCTimeOnlyTime
TZTimestampTzTimestamp
TZTimeOnlyTzTime
UTCDateOnlyDate

§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]);

  1. 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§

CheckSum
The result of a FIX checksum calculation (0-255).
Date
Representation for LocalMktDate and and UTCDateOnly in YYYYMMDD format.
MonthYear
Canonical data field (DTF) for FixDatatype::MonthYear.
MultipleChars
An Iterator over space-delimited bytes in a MultipleCharValue FIX field.
MultipleStrings
An Iterator over space-delimited byte sequences in a MultipleStringValue 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.
ZeroPadding
Zero-padding for integers; see FixValue::SerializeSettings.

Functions§

test_utility_verify_serialization_behavior
Tries to FixValue::serialize an item, then to FixValue::deserialize it, and finally checks for equality with the initial data. FixValue::deserialize_lossy is then tested in the same manner.

Type Aliases§

Country
Type alias for ISO 3166-1 alpha-2 strings (two-letter country codes).
Currency
Type alias for ISO 4217 alpha codes (three-letter currency codes).
Exchange
Type alias for four-letter Market Identifier Codes (MICs) as defined by ISO 10383.