Struct RawFrame

Source
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>
where T: AsRef<[u8]>,

Source

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);
Source

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");
Source

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§

Source§

impl<T: Debug> Debug for RawFrame<T>

Source§

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

Formats the value using the given formatter. Read more

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> 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> 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, 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.