Dictionary

Struct Dictionary 

Source
pub struct Dictionary { /* private fields */ }
Expand description

Specifies business semantics for application-level entities within the FIX Protocol.

You can rely on Dictionary for accessing details about fields, messages, and other abstract entities as defined in the FIX specifications. Examples of such information include:

  • The mapping of FIX field names to numeric tags (e.g. BeginString is 8).
  • Which FIX fields are mandatory and which are optional.
  • The data type of each and every FIX field.
  • What fields to expect in FIX headers.

N.B. The FIX Protocol mandates separation of concerns between session and application protocol only for FIX 5.0 and subsequent versions. All FIX Dictionaries for older versions will also contain information about the session layer.

Implementations§

Source§

impl Dictionary

Source

pub fn new<S: ToString>(version: S) -> Self

Creates a new empty FIX Dictionary named version.

Source

pub fn from_quickfix_spec(input: &str) -> Result<Self, ParseDictionaryError>

Attempts to read a QuickFIX-style specification file and convert it into a Dictionary.

Source

pub fn version(&self) -> &str

Returns the version string associated with this Dictionary (e.g. FIXT.1.1, FIX.4.2).

use hotfix_dictionary::Dictionary;

let dict = Dictionary::fix44();
assert_eq!(dict.version(), "FIX.4.4");
Source

pub fn load_from_file(path: &str) -> Result<Self, ParseDictionaryError>

Source

pub fn fix44() -> Self

Creates a new Dictionary for FIX 4.4.

Source

pub fn common_dictionaries() -> Vec<Dictionary>

Returns a Vec of FIX Dictionary’s for the most common FIX versions (that have been enabled via feature flags). This is only intended for testing purposes.

Source

pub fn message_by_name(&self, name: &str) -> Option<MessageDefinition<'_>>

Returns the [Message] associated with name, if any.

use hotfix_dictionary::Dictionary;

let dict = Dictionary::fix44();

let msg1 = dict.message_by_name("Heartbeat").unwrap();
let msg2 = dict.message_by_msgtype("0").unwrap();
assert_eq!(msg1.name(), msg2.name());
Source

pub fn message_by_msgtype(&self, msgtype: &str) -> Option<MessageDefinition<'_>>

Returns the [Message] that has the given msgtype, if any.

use hotfix_dictionary::Dictionary;

let dict = Dictionary::fix44();

let msg1 = dict.message_by_msgtype("0").unwrap();
let msg2 = dict.message_by_name("Heartbeat").unwrap();
assert_eq!(msg1.name(), msg2.name());
Source

pub fn component_by_name(&self, name: &str) -> Option<Component<'_>>

Returns the [Component] named name, if any.

Source

pub fn datatype_by_name(&self, name: &str) -> Option<Datatype<'_>>

Returns the Datatype named name, if any.

use hotfix_dictionary::Dictionary;

let dict = Dictionary::fix44();
let dt = dict.datatype_by_name("String").unwrap();
assert_eq!(dt.name(), "String");
Source

pub fn field_by_tag(&self, tag: u32) -> Option<Field<'_>>

Returns the Field associated with tag, if any.

use hotfix_dictionary::Dictionary;

let dict = Dictionary::fix44();
let field1 = dict.field_by_tag(112).unwrap();
let field2 = dict.field_by_name("TestReqID").unwrap();
assert_eq!(field1.name(), field2.name());
Source

pub fn field_by_name(&self, name: &str) -> Option<Field<'_>>

Returns the Field named name, if any.

Source

pub fn datatypes(&self) -> Vec<Datatype<'_>>

Returns a Vec of all Datatype’s in this Dictionary. The ordering of items is not specified.

use hotfix_dictionary::Dictionary;

let dict = Dictionary::fix44();
// FIX 4.4 defines 23 (FIXME) datatypes.
assert_eq!(dict.datatypes().len(), 23);
Source

pub fn messages(&self) -> Vec<MessageDefinition<'_>>

Returns a Vec of all [Message]’s in this Dictionary. The ordering of items is not specified.

use hotfix_dictionary::Dictionary;

let dict = Dictionary::fix44();
let msgs = dict.messages();
let msg = msgs.iter().find(|m| m.name() == "MarketDataRequest");
assert_eq!(msg.unwrap().msg_type(), "V");
Source

pub fn fields(&self) -> Vec<Field<'_>>

Returns a Vec of all Field’s in this Dictionary. The ordering of items is not specified.

Source

pub fn components(&self) -> Vec<Component<'_>>

Returns a Vec of all [Component]’s in this Dictionary. The ordering of items is not specified.

Trait Implementations§

Source§

impl Clone for Dictionary

Source§

fn clone(&self) -> Dictionary

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Dictionary

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.