Skip to main content

FixMessage

Trait FixMessage 

Source
pub trait FixMessage: Sized {
    const MSG_TYPE: &'static str;

    // Required methods
    fn from_raw(raw: &RawMessage<'_>) -> Result<Self, DecodeError>;
    fn encode(&self, buf: &mut Vec<u8>) -> Result<(), EncodeError>;
}
Expand description

Trait for typed FIX message access.

This trait is implemented by generated message types to provide type-safe encoding and decoding.

Required Associated Constants§

Source

const MSG_TYPE: &'static str

The message type string (e.g., “D” for NewOrderSingle).

Required Methods§

Source

fn from_raw(raw: &RawMessage<'_>) -> Result<Self, DecodeError>

Decodes a message from a raw message.

§Arguments
  • raw - The raw message to decode
§Errors

Returns DecodeError if the message cannot be decoded.

Source

fn encode(&self, buf: &mut Vec<u8>) -> Result<(), EncodeError>

Encodes the message to a buffer.

§Arguments
  • buf - The buffer to write to
§Errors

Returns EncodeError if the message cannot be encoded.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§