Skip to main content

peek_deferrable_sender

Function peek_deferrable_sender 

Source
pub fn peek_deferrable_sender(bytes: &[u8]) -> Option<String>
Expand description

Decode a received message LAZILY when its top-level value is a self-describing record-list view (T_STRUCTS_VIEW): returns (sender, List(WireStructs)) holding the raw frame, so NO row is decoded until a field is touched — the production zero-copy receive (“no decode in production”, Cap’n Proto’s home). Any other shape (scalars, maps, single structs, cached/compressed bodies) falls back to a full message_from_wire decode, so every message still round-trips. The receiver opts in with the view knob; without it, the eager path is used exactly as before. Peek a frame: if its top-level value is a self-describing DEFERRABLE view — a record list (T_STRUCTS_VIEW) or an aligned numeric column (T_INTS_ALIGNED/T_FLOATS_ALIGNED), all of which have no schema-cache dependency — return the sender so its decode can be deferred to Await (lazy under view, eager otherwise). None for anything else (scalars, single structs, maps, cached, or compressed bodies), which must decode eagerly in arrival order. The drain loop uses this to split deferrable views from order-sensitive messages.