Expand description
Wire envelope for the host ↔ guest RPC.
Both directions (host → guest function call, guest → host
callback) use the same Request / Response shapes. The
payload is opaque bytes — each fn_id defines its own inner
codec (today: rkyv-archived domain types like
nub_arch_x86_abi::{InvocationSpec, InvocationResult}).
§Wire layout
Serializing a Request or Response with rkyv::to_bytes
produces an AlignedVec<u8> that contains:
- An archived
Request/Responsewhosepayloadfield is anArchivedVec<u8>(the bytes laid out inline). - The rkyv root pointer trailer (a relative offset + length).
Readers run rkyv::access::<ArchivedRequest, _>(&bytes) (with
bytecheck) and pull archived.payload.as_ref() -> &[u8] to
reach the inner payload — zero allocation, single pointer cast
plus the cheap bytecheck pass.
Direction is encoded by which shared-memory ring the bytes live in (host’s input vs output ring), not by the type.
Structs§
- Archived
Request - An archived
Request - Archived
Response - An archived
Response - Request
- Host → guest function call OR guest → host callback. The
payloadis opaque to the envelope: the fn_id selects what inner codec applies. - Request
Resolver - The resolver for an archived
Request - Response
- Reply to a
Request.status == 0means OK; non-zero is a receiver-defined error code with the human-readable detail inerror_msg(mostly for debugging). - Response
Resolver - The resolver for an archived
Response