Crate fix44_forge_helpers

Crate fix44_forge_helpers 

Source
Expand description

§fix44-forge-helpers

High-performance helper functions for FIX 4.4 protocol parsing and serialization.

This crate provides zero-allocation, minimal-branching functions for reading and writing FIX protocol data types. It’s designed for hot-path performance in financial applications where every nanosecond counts.

§Platform Support

Unix/Linux Only - This crate requires Unix-like systems and will NOT compile on Windows. Uses libc::clock_gettime and other Unix-specific system calls for maximum performance.

§Performance Philosophy

  • Zero allocations in hot paths
  • Minimal branching for maximum performance
  • Early termination on invalid input
  • Wrapping arithmetic semantics for overflow handling
  • Direct buffer manipulation for optimal cache usage

§Example

use fix44_forge_helpers::*;

// Reading from bytes
let value = read_u32(b"12345");
assert_eq!(value, 12345);

// Writing with pre-initialized forge buffer
let mut buffer = forge_out_buffer("FIX.4.4");
let mut pos = FORGE_WRITE_START; // Header "8=FIX.4.4\x019=0000\x0135=" already there!

// Write MsgType value (tag "35=" already present)
buffer[pos] = b'D'; pos += 1;
buffer[pos] = 0x01; pos += 1; // SOH

// Continue with other fields
pos += write_tag_and_u32(&mut buffer, pos, b"34=", 123);

// Update BodyLength with actual length
update_body_length(&mut buffer, pos);
// Result: "8=FIX.4.4\x019=0012\x0135=D\x0134=123\x01"

Re-exports§

pub use buffer::*;
pub use errors::*;
pub use reading::*;
pub use special::*;
pub use writing::*;

Modules§

buffer
Buffer management for FIX message creation and manipulation.
errors
Error types for FIX protocol parsing and validation.
reading
High-performance reading functions for FIX protocol data types.
special
Special FIX protocol functions for timestamps, ClOrdID generation, and other utilities.
writing
High-performance writing functions for FIX protocol data types.