Module std::encoding::wire

Wire format encoding and decoding.

import std::encoding::wire;

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 type declarations instead of calling these functions directly.

Contents

Functions

Function encode_header

pub fn encode_header(payload_len: i32, flags: i32) -> bytes

Encode a wire format header for a message.

payload_len is the byte length of the serialized payload. flags controls optional features (e.g., 1 for compression).

Returns the 10-byte encoded header as a bytes value.

Function decode_header

pub fn decode_header(buffer: bytes) -> i64

Decode a wire format header from a bytes buffer.

Returns the payload length on success, or -1 if the header is invalid.

Function validate_header

pub fn validate_header(buffer: bytes) -> bool

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

Returns true if the header is valid.