Skip to main content

Module native

Module native 

Source
Expand description

Bounded Serde/Postcard encoding, decoding and request/response framing. Explicit resource admission for native Serde payloads in the same Postcard format.

Types, IDs, deterministic serialization and domain rules are consumer-owned. Resource admission follows Serde visits; no static schema is inferred. Custom Serde implementations are trusted: allocations/work outside visited values cannot be constrained here. See the runtime guide for budget semantics.

Constants§

REQUEST_HEADER_BYTES
Native request frame header size, including magic, identity and direction.

Functions§

decode
Decode a complete Postcard payload; allocation admission precedes visitor calls. Borrowed bytes and strings may refer directly to the input for its lifetime. Primitive representations are checked while reading; Serde normalization is consumer-owned.
decode_request
Check request identity and direction before decoding its bounded native value.
decode_response
Check response identity and direction before decoding its bounded native value.
encode
Encode an owned or borrowed native payload under explicit traversal allowances.
encode_into
Encode into reusable caller storage. Previous contents are cleared, including on error. Capacity may be lost on serialization failure; successful calls retain it. Retain a separate immutable frame when bytes must survive subsequent calls for retries.
encode_request
Encode a complete request; limits.bytes includes the canonical frame header.
encode_request_into
Encode a request into reusable storage; follows encode_into failure semantics.
encode_request_to_slice
Encode a complete request into caller storage; follows encode_to_slice.
encode_response
Encode a complete response, including borrowed response projections.
encode_response_into
Encode a response into reusable storage; follows encode_into failure semantics.
encode_response_to_slice
Encode a complete response into caller storage; follows encode_to_slice.
encode_to_slice
Encode a payload into caller-owned storage without allocating codec output.
encoded_frame_len
Measure a request or response frame; both directions have equal header length.
encoded_len
Measure one native payload with no output allocation; bytes excludes a frame.
method_id
Stable automatic endpoint identity from the exact exported IC method name.
validate_request_header
Validate only the fixed request header before a transport copies the payload. The complete request still requires normal decoding and resource admission. This delegates to the same validator previously used inside Wire’s endpoint module: accepted bytes and error ordering are unchanged after its package move.
with_encoded
Encode a payload using scratch storage or owned fallback, then consume its bytes.