Skip to main content

Module rawabi

Module rawabi 

Source
Expand description

The RAW handler ABI (bc#76): a de-boxed handler boundary so a generated typed module materializes a struct DIRECTLY from the wire payload, with no intermediate dynamic Value/Value::Obj tree on the row data plane.

§Why this exists (the boxing #75 left)

The typed codegen (#47/#48) materialized structs from an ALREADY-BOXED Value:

fn marshal_T0(raw: &Value) -> Result<T0, BehaviorError>   // raw is a Value::Obj tree

The consumer’s read handler first built the full dynamic Value tree and the generated module then WALKED it into a struct — ADDING a Value->struct conversion on top of the boxing instead of REPLACING it. The residual ~22% Rust gap #75 measured is exactly that Value/Value::Obj deep-clone at the handler ABI boundary (Rust felt it most: the Value enum boxes every Obj pair into a heap Vec<(String, Value)> that is cloned at the ABI, then re-walked).

bc’s conformance handlers return a Value mock, so the suite structurally could not see what the consumer’s real handler did BEFORE the Value reached the module — the blind spot that let bc#47’s B2 layering recur one layer out as bc#76.

§The seam

A RAW handler yields a RawValue — a native-backed accessor tree that is NOT a Value. The generated raw marshaller matches on it (scalar / RawRow / arr) straight into the concrete struct. The dynamic Value tree never exists on the row data plane; boxing is REPLACED, not layered. RawRow::field is the monomorphized wire read a hand-written v1-native struct-from-row would do.

Structs§

RawRow
The object accessor on the raw data plane: a direct native field read that materializes NO Value::Obj. bc conformance uses this native Vec-backed row (no real wire format) so the generated raw marshaller exercises the de-boxed path; a real consumer implements the same shape over its wire payload (e.g. an AttributeValue map).

Enums§

RawOutcome
A RAW handler execution result. Ok carries a RawValue (native-backed), NOT a boxed Value — that is the whole de-box.
RawValue
A handler result on the RAW data plane — deliberately NOT a Value: the whole point of #76 is that the dynamic Value/Value::Obj tree is never built here. A real consumer’s handler returns its native wire shape as a RawValue with no Value allocation.

Traits§

NativeComponentExec
The NATIVE-PORTS handler registry seam: the handler receives the generated native ports struct behind a PortReader and returns an ExecOutcome (a boxed Value RESULT — the UNTYPED straight-line path has no target struct to de-box the result into, and returns the boxed Value as the component output, exactly as the generic path does). NO generic Vec<(String, Value)> port CONTAINER is built on the port plane — that is the de-plumb.
NativeRawComponentExec
The combined handler registry seam (bc#94, nativized): native ports in (a CONCRETE &P, passed by monomorphized generic instantiation — no &dyn, no as_any/downcast), RawValue out.
PortReader
The optional uniform read accessor a generated native ports struct implements so a consumer that does not downcast can still read ports by name. Reading a statically-typed field this way clones/boxes ONLY that one field into a Value on demand (no Vec, no eager boxing of every port) — a hot-path consumer downcasts (as_any) and reads the typed fields directly.
PortReaderT
The COVERED-path port accessor (bc#94): the by-name read a combined handler uses, WITHOUT the dynamic PortReader::as_any downcast hook. The generated combined runner passes each node’s CONCRETE ports struct to the handler by direct generic instantiation (&P where P: PortReaderT, monomorphized per node) — never behind &dyn, never via as_any/downcast. A PortReaderT handler still reads a port by name (boxing that one field on demand) if it does not want to name the concrete struct type, but the SEAM itself carries no dyn/as_any: the concrete type flows through monomorphization. (PortReader — with as_any — stays for the UNCOVERED NativeComponentExec path, retired later.)
RawComponentExec
The RAW handler registry seam: like ComponentExec, but the handler returns a RawValue (native-backed) instead of a boxed Value. A generated raw-ABI module dispatches through this and materializes structs directly from the RawValue — no dynamic Value tree on the row data plane.

Functions§

raw_from_value
Lower a dynamic Value into the equivalent native-backed RawValue. This is the ADAPTER bc’s conformance uses to feed the RAW path from the SAME vectors the boxed path uses (so behavior-equality is checked against run_behavior on identical data). It is a TEST/BENCH-ADAPTER that lives OFF the hot path: a real consumer never builds a Value first — it produces RawValue from its wire payload directly. The de-box win is measured against v1-native precisely because production skips this step.
raw_missing_prop
Build a MISSING_PROP BehaviorError (symmetric with the boxed marshaller’s fail-closed path) for a raw marshaller. Kept here so the generated raw code raises the same coded failure as run_behavior.
raw_type_mismatch
Build a TYPE_MISMATCH BehaviorError for a raw marshaller.