pub struct Message<'a, T> { /* private fields */ }
Expand description
A FIX message returned by Decoder
or [DecoderStreaming
].
Implementations§
Source§impl<'a, T> Message<'a, T>
impl<'a, T> Message<'a, T>
Sourcepub fn fields(&'a self) -> Fields<'a, T> ⓘ
pub fn fields(&'a self) -> Fields<'a, T> ⓘ
Returns an Iterator
over all fields in self
, in sequential order
starting from the very first field.
§Examples
use hotfix_encoding::config::{Config, GetConfig};
use hotfix_encoding::decoder::{Decoder};
use hotfix_dictionary::{Dictionary, TagU32};
const DATA: &[u8] = b"8=FIX.4.4|9=42|35=0|49=A|56=B|34=12|52=20100304-07:59:30|10=185|";
let mut decoder = Decoder::new(Dictionary::fix44());
decoder.config_mut().separator = b'|';
let message = decoder.decode(DATA).unwrap();
let first_field = message.fields().next();
assert_eq!(first_field, Some((TagU32::new(8).unwrap(), b"FIX.4.4" as &[u8])));
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Returns the underlying byte contents of self
.
§Examples
use hotfix_encoding::config::{Config, GetConfig};
use hotfix_encoding::decoder::{Decoder};
use hotfix_dictionary::{Dictionary, TagU32};
const DATA: &[u8] = b"8=FIX.4.4|9=42|35=0|49=A|56=B|34=12|52=20100304-07:59:30|10=185|";
let mut decoder = Decoder::new(Dictionary::fix44());
decoder.config_mut().separator = b'|';
let message = decoder.decode(DATA).unwrap();
assert_eq!(message.as_bytes(), DATA);
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of FIX tags contained in self
.
§Examples
use hotfix_encoding::config::{Config, GetConfig};
use hotfix_encoding::decoder::{Decoder};
use hotfix_dictionary::{Dictionary, TagU32};
const DATA: &[u8] = b"8=FIX.4.4|9=42|35=0|49=A|56=B|34=12|52=20100304-07:59:30|10=185|";
let mut decoder = Decoder::new(Dictionary::fix44());
decoder.config_mut().separator = b'|';
let message = decoder.decode(DATA).unwrap();
assert_eq!(message.len(), message.fields().count());
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl<'a, F, T> FieldMap<&F> for Message<'a, T>
impl<'a, F, T> FieldMap<&F> for Message<'a, T>
Source§type Group = MessageGroup<'a, T>
type Group = MessageGroup<'a, T>
The type returned by
FieldMap::group
and
FieldMap::group_opt
.Source§fn get_raw(&self, field: &F) -> Option<&[u8]>
fn get_raw(&self, field: &F) -> Option<&[u8]>
Looks for a
field
within self
and then returns its raw byte
contents, if it exists.Source§fn group(
&self,
field: &F,
) -> Result<Self::Group, FieldValueError<<usize as FieldType<'_>>::Error>>
fn group( &self, field: &F, ) -> Result<Self::Group, FieldValueError<<usize as FieldType<'_>>::Error>>
Looks for a group that starts with
field
within self
.Source§fn group_opt(
&self,
field: F,
) -> Result<Option<Self::Group>, <usize as FieldType<'_>>::Error>
fn group_opt( &self, field: F, ) -> Result<Option<Self::Group>, <usize as FieldType<'_>>::Error>
Like
FieldMap::group
, but doesn’t return an Err
if the
group is missing.Source§fn get<'a, V>(&'a self, field: F) -> Result<V, FieldValueError<V::Error>>where
V: FieldType<'a>,
fn get<'a, V>(&'a self, field: F) -> Result<V, FieldValueError<V::Error>>where
V: FieldType<'a>,
Looks for a
field
within self
and then decodes its raw byte contents
via FieldType::deserialize
, if found.Source§fn get_lossy<'a, V>(&'a self, field: F) -> Result<V, FieldValueError<V::Error>>where
V: FieldType<'a>,
fn get_lossy<'a, V>(&'a self, field: F) -> Result<V, FieldValueError<V::Error>>where
V: FieldType<'a>,
Like
FieldMap::get
, but with lossy deserialization.Source§fn get_lossy_opt<'a, V>(&'a self, field: F) -> Result<Option<V>, V::Error>where
V: FieldType<'a>,
fn get_lossy_opt<'a, V>(&'a self, field: F) -> Result<Option<V>, V::Error>where
V: FieldType<'a>,
Like
FieldMap::get_opt
, but with lossy deserialization.Source§impl<'a, T> FieldMap<u32> for Message<'a, T>
impl<'a, T> FieldMap<u32> for Message<'a, T>
Source§type Group = MessageGroup<'a, T>
type Group = MessageGroup<'a, T>
The type returned by
FieldMap::group
and
FieldMap::group_opt
.Source§fn get_raw(&self, tag: u32) -> Option<&[u8]>
fn get_raw(&self, tag: u32) -> Option<&[u8]>
Looks for a
field
within self
and then returns its raw byte
contents, if it exists.Source§fn group(
&self,
tag: u32,
) -> Result<Self::Group, FieldValueError<<usize as FieldType<'_>>::Error>>
fn group( &self, tag: u32, ) -> Result<Self::Group, FieldValueError<<usize as FieldType<'_>>::Error>>
Looks for a group that starts with
field
within self
.Source§fn group_opt(
&self,
field: F,
) -> Result<Option<Self::Group>, <usize as FieldType<'_>>::Error>
fn group_opt( &self, field: F, ) -> Result<Option<Self::Group>, <usize as FieldType<'_>>::Error>
Like
FieldMap::group
, but doesn’t return an Err
if the
group is missing.Source§fn get<'a, V>(&'a self, field: F) -> Result<V, FieldValueError<V::Error>>where
V: FieldType<'a>,
fn get<'a, V>(&'a self, field: F) -> Result<V, FieldValueError<V::Error>>where
V: FieldType<'a>,
Looks for a
field
within self
and then decodes its raw byte contents
via FieldType::deserialize
, if found.Source§fn get_lossy<'a, V>(&'a self, field: F) -> Result<V, FieldValueError<V::Error>>where
V: FieldType<'a>,
fn get_lossy<'a, V>(&'a self, field: F) -> Result<V, FieldValueError<V::Error>>where
V: FieldType<'a>,
Like
FieldMap::get
, but with lossy deserialization.Source§fn get_lossy_opt<'a, V>(&'a self, field: F) -> Result<Option<V>, V::Error>where
V: FieldType<'a>,
fn get_lossy_opt<'a, V>(&'a self, field: F) -> Result<Option<V>, V::Error>where
V: FieldType<'a>,
Like
FieldMap::get_opt
, but with lossy deserialization.impl<'a, T: Copy> Copy for Message<'a, T>
impl<'a, T> Eq for Message<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for Message<'a, T>
impl<'a, T> RefUnwindSafe for Message<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Message<'a, T>where
T: Send,
impl<'a, T> Sync for Message<'a, T>where
T: Sync,
impl<'a, T> Unpin for Message<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for Message<'a, T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more