Skip to main content

FixSequenceTracker

Struct FixSequenceTracker 

Source
pub struct FixSequenceTracker { /* private fields */ }
Expand description

Deterministic inbound/outbound FIX sequence tracker.

Implementations§

Source§

impl FixSequenceTracker

Source

pub const fn new() -> Self

Creates a tracker with both inbound and outbound sequence numbers set to 1.

Source

pub const fn from_next(next_inbound: u64, next_outbound: u64) -> Self

Creates a tracker from persisted next inbound and outbound values.

Values lower than 1 are clamped to 1 so restored state remains valid.

Source

pub const fn next_inbound(&self) -> u64

Returns the next inbound sequence number expected from the counterparty.

Source

pub const fn next_outbound(&self) -> u64

Returns the next outbound sequence number to assign.

Source

pub fn assign_outbound(&mut self) -> u64

Assigns and advances the next outbound sequence number.

Source

pub fn observe_message( &mut self, message: &FixMessageView<'_>, ) -> Result<FixSequenceAction, FixSequenceError>

Observes an inbound message and returns the sequence action.

§Errors

Returns FixSequenceError when MsgSeqNum(34) is missing or zero.

Source

pub fn observe_inbound( &mut self, seq_no: u64, poss_dup: bool, ) -> Result<FixSequenceAction, FixSequenceError>

Observes an inbound sequence number.

§Errors

Returns FixSequenceError::ZeroSeqNo when seq_no is zero.

Source

pub fn apply_sequence_reset( &mut self, new_seq_no: u64, ) -> Result<(), FixSequenceError>

Applies NewSeqNo(36) as the next expected inbound sequence number.

§Errors

Returns FixSequenceError::ZeroSeqNo for zero and FixSequenceError::SequenceResetWouldDecrease when the reset would lower the current expected sequence number.

Source

pub fn set_next_inbound(&mut self, next_inbound: u64)

Sets the next inbound sequence number from trusted persisted state.

Source

pub fn set_next_outbound(&mut self, next_outbound: u64)

Sets the next outbound sequence number from trusted persisted state.

Source

pub fn snapshot<'a>( &self, session_id: FixSessionId<'a>, trading_day: &'a [u8], ) -> Result<FixSequenceSnapshot<'a>, FixEncodeError>

Creates a persistable snapshot for this tracker.

§Errors

Returns FixEncodeError when trading_day contains SOH.

Source

pub const fn from_snapshot(snapshot: &FixSequenceSnapshot<'_>) -> Self

Restores tracker counters from a sequence snapshot.

Source

pub fn reset_to_one(&mut self)

Resets both inbound and outbound counters to 1.

Trait Implementations§

Source§

impl Clone for FixSequenceTracker

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FixSequenceTracker

Source§

impl Debug for FixSequenceTracker

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for FixSequenceTracker

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for FixSequenceTracker

Source§

impl PartialEq for FixSequenceTracker

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FixSequenceTracker

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.