Module wire

Wire format encoding and decoding.

Low-level functions for Hew's binary wire protocol, used by the runtime for actor-to-actor message serialization across network boundaries.

Most users should use wire struct declarations instead of calling these functions directly.

Contents

Functions

Function encode_header

pub fn encode_header(msg_type: i32, payload_size: i32) -> string

Encode a wire format header for a message.

msg_type is the message type tag. payload_size is the byte length of the serialized payload.

Returns the encoded header as a byte string.

Function decode_header

pub fn decode_header(buffer: string, offset: i64) -> i64

Decode a wire format header from a byte buffer.

buffer is the raw header bytes. offset is the starting byte position in the buffer.

Returns a packed i64 encoding the message type and payload size.

Function validate_header

pub fn validate_header(buffer: string, offset: i64) -> bool

Validate that a byte buffer contains a well-formed wire header.

Returns true if the header at offset is valid.