zwire 0.1.0

Zero-dependency, no_std-compatible transactional reactive state engine: scoped push-pull arena, rebaseable optimistic layers + STM drafts, exact incremental Top-K collections, and open @zwire/core wire protocols
Documentation
//! **zwire** — zero-dependency, `#![no_std]` (`alloc`) transactional reactive state engine
//! for Rust.
//!
//! Umbrella facade re-exporting:
//! - [`core`] (`zwire-core`) — Zero-global scoped push-pull arena & deadlock-free `SyncScope`
//! - [`tx`] (`zwire-tx`) — Rebaseable `OptimisticLayer`, RAII `OptimisticGuard`, atomic
//!   `try_settle`, and STM read-verify `Draft`
//! - [`collections`] (`zwire-collections`) — Exact 2-level Chunked B-Tree + `O(1)` Top-K
//! - [`protocol`] (`zwire-protocol`) — Zero-dep JSON `WireValue`, out-of-order hydration,
//!   `ExternalSource`, `SyncBridge`, and `InspectorHook` compatible with `@zwire/core`
//! - [`ReactiveCollection`] — First-class reactive `top_k_signal(k)` bridging `collections` + `core`

#![cfg_attr(not(feature = "std"), no_std)]

extern crate alloc;

#[cfg(feature = "collections")]
pub use zwire_collections as collections;
#[cfg(feature = "core")]
pub use zwire_core as core;
#[cfg(feature = "protocol")]
pub use zwire_protocol as protocol;
#[cfg(feature = "tx")]
pub use zwire_tx as tx;

#[cfg(all(feature = "core", feature = "collections"))]
mod reactive_collection;
#[cfg(all(feature = "core", feature = "collections"))]
pub use reactive_collection::ReactiveCollection;

/// Convenient re-exports of the most commonly used `zwire` primitives.
pub mod prelude {
    #[cfg(all(feature = "core", feature = "collections"))]
    pub use crate::ReactiveCollection;
    #[cfg(feature = "collections")]
    pub use crate::collections::{AcceptAll, Collection, TopKViewId};
    #[cfg(feature = "core")]
    pub use crate::core::{
        Atom, AtomOptions, Computed, ComputedOptions, CoreError, EvalContext, HookGuard, NodeId,
        Scope, ScopeMode, Signal, Subscription, WeakScope,
    };
    #[cfg(feature = "sync")]
    pub use crate::core::{
        SyncAtom, SyncAtomOptions, SyncCleanupFn, SyncComputed, SyncComputedOptions,
        SyncEvalContext, SyncHookGuard, SyncScope, SyncSignal, SyncSubscription, WeakSyncScope,
    };
    #[cfg(feature = "protocol")]
    pub use crate::protocol::{
        ExternalSource, HydratedState, InspectorHook, PatchOrigin, StatePatch, SyncAdapter,
        SyncBridge, SyncBridgeOptions, WireCodec, WireValue, attach_inspector, create_sync_bridge,
        dehydrate, dehydrate_json, from_external_source, hydratable, hydrate, hydrate_json,
    };
    #[cfg(feature = "tx")]
    pub use crate::tx::{Draft, DraftBase, DraftError, OptimisticGuard, OptimisticLayer};
}

#[cfg(all(
    doctest,
    feature = "std",
    feature = "core",
    feature = "tx",
    feature = "collections",
    feature = "protocol"
))]
#[doc = include_str!("../README.md")]
mod readme_doctests {}