pub struct Decoder { /* private fields */ }
Expand description
FIX message decoder.
One should create a Decoder
per stream of FIX messages.
Implementations§
Source§impl Decoder
impl Decoder
Sourcepub fn new(dict: Dictionary) -> Self
pub fn new(dict: Dictionary) -> Self
Creates a new Decoder
for the tag-value format. dict
is used to parse
messages.
Sourcepub fn decode<T>(&mut self, bytes: T) -> Result<Message<'_, T>, DecodeError>
pub fn decode<T>(&mut self, bytes: T) -> Result<Message<'_, T>, DecodeError>
Decodes data
and returns an immutable reference to the obtained
message.
§Examples
use hotfix_dictionary::{Dictionary};
use hotfix_encoding::fix44;
use hotfix_encoding::config::{Config, GetConfig};
use hotfix_encoding::decoder::Decoder;
use hotfix_encoding::field_access::FieldMap;
let dict = Dictionary::fix44();
let mut decoder = Decoder::new(dict);
decoder.config_mut().separator = b'|';
let data = b"8=FIX.4.4|9=42|35=0|49=A|56=B|34=12|52=20100304-07:59:30|10=185|";
let message = decoder.decode(data).unwrap();
assert_eq!(message.get(fix44::SENDER_COMP_ID), Ok("A"));
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Decoder
impl RefUnwindSafe for Decoder
impl Send for Decoder
impl Sync for Decoder
impl Unpin for Decoder
impl UnwindSafe for Decoder
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