Skip to main content

Message

Struct Message 

Source
pub struct Message {
    pub header: FieldMap,
    pub body: FieldMap,
    pub trailer: FieldMap,
    /* private fields */
}
Expand description

A FIX message split into header, body, and trailer regions.

Decoding routes session-level header tags and trailer tags to their regions; everything else lands in the body. Encoding always emits the canonical order 8, 9, 35, <rest of header>, <body>, <trailer except 10>, 10.

Fields§

§header: FieldMap

Header fields (BeginString, BodyLength, MsgType, session fields, …).

§body: FieldMap

Application/body fields.

§trailer: FieldMap

Trailer fields (SignatureLength, Signature, CheckSum).

Implementations§

Source§

impl Message

Source

pub fn new() -> Self

Create an empty message.

Source

pub fn begin_string(&self) -> Option<&str>

The BeginString (tag 8) as a string, if present and valid UTF-8.

Source

pub fn fields_out_of_order(&self) -> bool

Whether decoding observed header/body/trailer fields out of their wire-sectioning order, or a third field other than MsgType(35) (ValidateFieldsOutOfOrder; FR-006). Always false for a Message built in code rather than decoded from the wire.

Source

pub fn msg_type(&self) -> Option<&str>

The MsgType (tag 35) as a string, if present and valid UTF-8.

Source

pub fn encode(&self) -> Vec<u8>

Encode to wire bytes (computes BodyLength and CheckSum).

Source

pub fn decode(bytes: &[u8]) -> Result<Self, DecodeError>

Decode from wire bytes (verifies BodyLength and CheckSum).

Source

pub fn reverse_route(&mut self, original: &Message)

Copy original’s routing header fields onto self (a reply/reject being built), reversed: original’s OnBehalfOfCompID(115) becomes self’s DeliverToCompID(128) and vice versa; likewise OnBehalfOfSubID(116)/DeliverToSubID(129) and OnBehalfOfLocationID(144)/DeliverToLocationID(145) (Appendix B ReverseRoute).

A routing tag absent on original is left unset on self — no reversal is attempted and no error is raised (ReverseRouteWithEmptyRoutingTags: a tag present with an empty value still reverses, since presence — not content — governs).

Trait Implementations§

Source§

impl Clone for Message

Source§

fn clone(&self) -> Message

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 Debug for Message

Source§

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

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

impl Default for Message

Source§

fn default() -> Message

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

impl Eq for Message

Source§

impl PartialEq for Message

Source§

fn eq(&self, other: &Message) -> 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 Message

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