cranpose-core
cranpose-core provides the composition runtime, reactive state, composition
locals, runtime scheduler support, and coroutine hooks used by Cranpose. Most
application code uses these services through the cranpose facade.
Depend directly on cranpose-core when you build a host integration, a
framework crate, or a lower-level runtime tool. App code with ordinary UI needs
the facade and widget crates instead.
State and runtime
The host creates a Runtime with a scheduler. The runtime gives state a place
to live and accepts snapshot commits. State changes mark subscribed scopes
for recomposition.
use ;
let _runtime = new;
let count = mutableStateOf;
assert_eq!;
let applied = run_in_mutable_snapshot;
assert!;
assert_eq!;
Composition code uses remember for values tied to a composition position and
CompositionLocalProvider for scoped values. ownedMutableStateOf gives Rust
owners an explicit state lifetime.
Features
The default feature set is empty. hot-reload selects source-structure keys for
development hot reload. std-hash selects the standard library hasher.
Runtime structure
The slot table stores active groups, payloads, and nodes. Retained inactive branches use detached subtrees. See the slot table invariants and the current slot table design.