zwire
Zero-dependency, #![forbid(unsafe_code)], #![no_std] (alloc), Rust 1.100 (Edition 2024) transactional reactive state engine for Rust — combining a scoped push-pull arena (Copy handles + SyncScope), rebaseable optimistic mutation layers + STM read-verify drafts, exact incremental 2-level Chunked B-Tree Top-K collections, and open JSON wire protocols compatible with @zwire/core.
Feature Flags & Modular Workspace
Use the umbrella zwire crate with granular feature flags, or depend directly on any standalone crate:
| Crate | Feature | Standalone? | What It Provides |
|---|---|---|---|
zwire-collections |
collections |
✅ | Exact 2-level Chunked B-Tree + O(1) Top-K boundary pruning (zero T: Clone) |
zwire-core |
core, sync |
✅ | Zero-global Scope + Copy handles + deadlock-free SyncScope (Send + Sync) |
zwire-tx |
tx |
core |
OptimisticLayer, RAII OptimisticGuard, atomic zero-flicker try_settle, STM Draft |
zwire-protocol |
protocol |
core |
Zero-dep JSON WireValue, out-of-order hydrate/dehydrate, ExternalSource, SyncBridge, InspectorHook |
# Only exact incremental Top-K collections (no_std + alloc, zero deps)
= { = "0.1", = false, = ["collections"] }
# Full transactional reactive engine + multi-threaded SyncScope + @zwire/core wire protocol
= "0.1"
Quick Start
use *;
let scope = new;
// 1. Reactive incremental Top-K collection (O(log N) updates, O(1) boundary skip)
let book = with_filter;
let top3 = book.top_k_signal;
let best_price = scope.computed;
book.upsert_many;
assert_eq!;
// 2. Overlapping rebaseable optimistic layers + RAII auto-revert guard
let balance = scope.atom;
let mut l1 = new;
l1.update; // UI: 800
// Authoritative server push arrives concurrently -> active intents auto-rebase!
scope.set;
assert_eq!;
// Atomic zero-flicker settle
l1.settle_with;
assert_eq!;
Running the Example & Tests
See docs/RUST-1.100-GUIDELINES.md for Rust 1.100 patterns, Clippy configuration, and invariants.