pub struct RawFrame<T> {
pub data: T,
pub begin_string: Range<usize>,
pub payload: Range<usize>,
}
Expand description
An immutable view over the contents of a FIX message by a RawDecoder
.
Fields§
§data: T
Raw, untouched contents of the message. Includes everything from BeginString <8>
up to
CheckSum <8>
.
begin_string: Range<usize>
The range of bytes that address the value of BeginString <8>
.
payload: Range<usize>
The range of bytes that address all contents after MsgType <35>
and before CheckSum <10>
.
Implementations§
Source§impl<T> RawFrame<T>
impl<T> RawFrame<T>
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Returns an immutable reference to the raw contents of self
.
§Examples
use hotfix_encoding::config::{Config, GetConfig};
use hotfix_encoding::raw_decoder::RawDecoder;
let mut decoder = RawDecoder::new();
decoder.config_mut().separator = b'|';
let data = b"8=FIX.4.2|9=42|35=0|49=A|56=B|34=12|52=20100304-07:59:30|10=022|";
let message = decoder.decode(data).unwrap();
assert_eq!(message.as_bytes(), data);
Sourcepub fn begin_string(&self) -> &[u8] ⓘ
pub fn begin_string(&self) -> &[u8] ⓘ
Returns an immutable reference to the BeginString <8>
field value of
self
.
§Examples
use hotfix_encoding::config::{Config, GetConfig};
use hotfix_encoding::raw_decoder::RawDecoder;
let mut decoder = RawDecoder::new();
decoder.config_mut().separator = b'|';
let data = b"8=FIX.4.2|9=42|35=0|49=A|56=B|34=12|52=20100304-07:59:30|10=022|";
let message = decoder.decode(data).unwrap();
assert_eq!(message.begin_string(), b"FIX.4.2");
Sourcepub fn payload(&self) -> &[u8] ⓘ
pub fn payload(&self) -> &[u8] ⓘ
Returns an immutable reference to the payload of self
. In this
context, “payload” means all fields besides
BeginString <8>
;BodyLength <9>
;CheckSum <10>
.
According to this definition, the payload may also contain fields that are
technically part of StandardHeader
and StandardTrailer
, i.e. payload
and body and not synonyms.
use hotfix_encoding::config::{Config, GetConfig};
use hotfix_encoding::raw_decoder::RawDecoder;
let mut decoder = RawDecoder::new();
decoder.config_mut().separator = b'|';
let data = b"8=FIX.4.2|9=42|35=0|49=A|56=B|34=12|52=20100304-07:59:30|10=022|";
let message = decoder.decode(data).unwrap();
assert_eq!(message.payload().len(), 42);
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for RawFrame<T>where
T: Freeze,
impl<T> RefUnwindSafe for RawFrame<T>where
T: RefUnwindSafe,
impl<T> Send for RawFrame<T>where
T: Send,
impl<T> Sync for RawFrame<T>where
T: Sync,
impl<T> Unpin for RawFrame<T>where
T: Unpin,
impl<T> UnwindSafe for RawFrame<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