forge_out_buffer

Function forge_out_buffer 

Source
pub fn forge_out_buffer() -> [u8; 1024]
Expand description

Create a pre-initialized buffer for FIX message writing.

This function returns a buffer that is already initialized with the fixed FIX header structure: “8=FIX.4.4\x019=0000\x0135=”

§Buffer Layout

  • Bytes 0-9: BeginString “8=FIX.4.4\x01”
  • Bytes 10-16: BodyLength placeholder “9=0000\x01”
  • Bytes 17-19: MsgType tag “35=”
  • Bytes 20+: Available for MsgType value and remaining message content

§Example

let mut buffer = forge_out_buffer();

// Fixed header is already there, start writing MsgType value
let mut pos = FORGE_WRITE_START;
buffer[pos] = b'D'; pos += 1; // Just the MsgType value
buffer[pos] = 0x01; pos += 1; // SOH after MsgType
// ... continue writing other fields
// Finally, update BodyLength at BODY_LENGTH_VALUE_POS

§Performance

This function performs a single 20-byte copy to initialize the entire fixed header structure. BeginString, BodyLength structure, and MsgType tag are never written again during message serialization.