Expand description
Shared wire-codec core — the exact byte format of the peer/transport codec
(logicaffeine_compile::concurrency::marshal), factored out so that TWO value models
encode and decode through ONE definition:
- the interpreter’s
RuntimeValue(host side), and - AOT-generated Rust
enum/structtypes (native side).
Because both go through this module, the wire bytes are byte-identical by construction — not a parallel re-implementation that can drift. This is what lets a compile-once native partial evaluator receive a program as data over the real fast codec, at native speed.
The tag bytes and field layout MUST stay in lockstep with marshal.rs; the
wire_bytes_match_peer_codec test in logicaffeine_compile proves it.
Constants§
- T_FALSE
- Boolean
false. - T_FLOAT
- An IEEE-754 double, 8 little-endian bytes.
- T_
INDUCTIVE - An inductive/enum value:
type_namestring,constructorstring, varint arg count, args. - T_INT
- A signed integer, zig-zag + LEB128 varint.
- T_LIST
- A heterogeneous list: varint element count, then each element (tagged).
- T_
NOTHING Nothing/ unit.- T_TEXT
- A UTF-8 string: varint byte-length, then the bytes.
- T_TRUE
- Boolean
true.
Traits§
- Wire
Decode - A value that reconstructs from the shared wire format.
- Wire
Encode - A value that serializes into the shared wire format.
Functions§
- expect_
tag - Read the tag byte at
posand advance;Noneif it is notexpected. - read_
inductive_ header - Read an inductive header, returning
(type_name, constructor, nargs). The caller dispatches onconstructorand readsnargsarguments viaWireDecode. - read_
str - Inverse of
write_str;Noneon truncation or invalid UTF-8. - read_
uvarint - Inverse of
write_uvarint;Noneon truncation or overlong (>64-bit) input. - unzigzag
- Inverse of
zigzag. - write_
inductive_ header - Write the header of an inductive value:
T_INDUCTIVE, itstype_name, itsconstructor, and the argument count. The args themselves follow, each written viaWireEncode. - write_
str - A length-prefixed UTF-8 string, UNtagged (used for inductive
type_name/constructor). - write_
uvarint - LEB128 unsigned varint.
- zigzag
- Map a signed integer onto an unsigned one so small magnitudes stay short.