Skip to main content

Module behavior_weft

Module behavior_weft 

Source
Expand description

Weft behaviors — the Thread’s native code, running beside the WASM floor (weft-v0.1 · behavior-abi-v0.1).

A manifest behavior may name a weft asset instead of a wasm one: a serialized weft::Module. It is verified on load — types, transitive effect rows, contracts, static fuel bound — and evaluated per event on the reference interpreter. Always available (no feature gate, no runtime dep): the native path is lighter than the floor.

The behavior contract mirrors the ABI’s: the entry definition is (state, event) → { state, actions }. The browser constructs the event by projecting the declared event type — a behavior receives exactly the fields its type asks for, defaulted where the browser has nothing to offer. Total in, total out: a Weft behavior cannot crash a world, run away, or perform an effect its row doesn’t declare.

Structs§

WeftBehavior
A loaded, verified Weft behavior: the module, its persistent state value, and the fuel ceiling (static bound + contract headroom).