Skip to main content

Decoder

Struct Decoder 

Source
pub struct Decoder<'a> { /* private fields */ }
Expand description

Zero-copy FIX message decoder.

The decoder parses FIX messages from a byte buffer, extracting fields as references to the original data without copying.

Implementations§

Source§

impl<'a> Decoder<'a>

Source

pub const fn new(input: &'a [u8]) -> Decoder<'a>

Creates a new decoder for the given input buffer.

§Arguments
  • input - The FIX message bytes to decode
Source

pub const fn with_checksum_validation(self, validate: bool) -> Decoder<'a>

Sets whether to validate checksums during decoding.

§Arguments
  • validate - Whether to validate checksums
Source

pub fn decode(&mut self) -> Result<RawMessage<'a>, DecodeError>

Decodes a complete FIX message from the buffer.

§Returns

A RawMessage containing zero-copy references to the parsed fields.

§Errors

Returns DecodeError if the message is malformed or incomplete.

Source

pub fn next_field(&mut self) -> Option<FieldRef<'a>>

Parses the next field from the buffer.

§Returns

The next field, or None if the buffer is exhausted.

Source

pub const fn offset(&self) -> usize

Returns the current offset in the buffer.

Source

pub fn remaining(&self) -> &'a [u8]

Returns the remaining bytes in the buffer.

Source

pub fn is_empty(&self) -> bool

Returns true if the buffer has been fully consumed.

Source

pub fn reset(&mut self)

Resets the decoder to the beginning of the buffer.

Trait Implementations§

Source§

impl<'a> Debug for Decoder<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Decoder<'a>

§

impl<'a> RefUnwindSafe for Decoder<'a>

§

impl<'a> Send for Decoder<'a>

§

impl<'a> Sync for Decoder<'a>

§

impl<'a> Unpin for Decoder<'a>

§

impl<'a> UnwindSafe for Decoder<'a>

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.