Skip to main content

FixField

Trait FixField 

Source
pub trait FixField: Sized {
    type Value;

    const TAG: u32;

    // Required methods
    fn decode(bytes: &[u8]) -> Result<Self::Value, DecodeError>;
    fn encode(value: &Self::Value, buf: &mut Vec<u8>);
}
Expand description

Trait for typed FIX field access.

This trait is implemented by generated field types to provide type-safe access to field values.

Required Associated Constants§

Source

const TAG: u32

The tag number for this field.

Required Associated Types§

Source

type Value

The Rust type for this field’s value.

Required Methods§

Source

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

Decodes the field value from a byte slice.

§Arguments
  • bytes - The raw bytes of the field value
§Errors

Returns DecodeError if the value cannot be decoded.

Source

fn encode(value: &Self::Value, buf: &mut Vec<u8>)

Encodes the field value to bytes.

§Arguments
  • value - The value to encode
  • buf - The buffer to write to

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§