hyphae
A lock-free reactive programming library for Rust.
Features
- Lock-free - Atomic updates via
arc-swap, no blocking - Type-safe - Compile-time checking with heterogeneous cell combinations
- Thread-safe - Safe concurrent access across threads
- Dependency tracking - Inspect and visualize cell relationships
Quick Start
use ;
let x = new;
let y = new;
// Combine cells with join + flat! macro
let sum = x.join.map;
// Subscribe to changes
let _guard = sum.subscribe;
x.set; // prints "Sum: 30"
Operators
Transform, combine, and filter reactive streams:
use Duration;
use ;
let doubled = x.map;
let filtered = x.filter;
let running_sum = numbers.scan;
let debounced = input.debounce;
let throttled = input.throttle;
let safe = fallible.catch_error;
Reactive Collections
use ;
let users = new;
let admin = users.get; // reactive cell
users.insert;
assert!; // updates automatically
Async Support
use ;
let cell = new;
let mut stream = cell.to_stream;
while let Some = stream.next.await
Requires the async feature flag.
Performance Monitoring
use Duration;
use Cell;
let cell = with_metrics;
cell.on_slow_subscriber;
License
MIT OR Apache-2.0