Skip to main content

Module message

Module message 

Source
Expand description

The core Message trait and DecodeOptions builder.

Every generated message type implements Message, which provides encode/decode/merge methods and a two-pass serialization model (compute_size populates a SizeCache, write_to consumes it) that avoids the exponential-time problem affecting naïve length-delimited encoders.

Structs§

DecodeContext
Per-decode limits threaded through every merge call.
DecodeOptions
Options for configuring message decoding behavior.

Constants§

DEFAULT_ELEMENT_MEMORY_LIMIT
Default element-memory budget: 32 MiB per top-level decode.
DEFAULT_UNKNOWN_FIELD_LIMIT
Default limit on unknown fields decoded per top-level decode: 1,000,000.
MAX_MESSAGE_BYTES
Maximum encoded size of a protobuf message: 2 GiB − 1 (0x7FFF_FFFF).
RECURSION_LIMIT
Default recursion depth limit for decoding nested messages.

Traits§

Message
The core trait implemented by all protobuf message types.
MessageName
Compile-time access to a generated message’s protobuf identifiers.

Functions§

checked_encode_size
Validate a computed encode size against MAX_MESSAGE_BYTES.
saturate_size
Saturate a u64 size accumulator to u32.