dowdiness/incr/cells does not have a README file
pub(all) enum AcceptStatus {
NoAccept
AcceptedChanged
AcceptedUnchanged
RetainedDueToError
} derive(Eq)impl Show for AcceptStatuspub struct AcceptedDerived[V, E] {
// private fields
}
fn AcceptedDerived::AcceptedDerived(rt : Runtime, compute : () -> Result[V, E], label? : String) -> AcceptedDerived[V, E]fn[V : BackdateEq + HasChangedAt, E : Eq] AcceptedDerived::accepted_memo(rt : Runtime, compute : () -> Result[V, E], label? : String) -> AcceptedDerived[V, E]fn[V : Eq, E] AcceptedDerived::from_candidate(candidate : Derived[Result[V, E]], label? : String) -> AcceptedDerived[V, E]fn[V, E] AcceptedDerived::snapshot(self : AcceptedDerived[V, E]) -> Result[AcceptedSnapshot[V, E], ReadError]pub struct AcceptedSnapshot[V, E] {
current : Result[V, E]
accepted : V?
status : AcceptStatus
} derive(Eq)pub struct Accumulator[T] {
// private fields
}fn[T, A] Derived::accumulated_or_abort(self : Derived[T], acc : Accumulator[A]) -> Array[A] raise Failurepub(all) enum DerivedEvent {
EnteringCompute(DerivedEnteringEvent)
Completed(DerivedCompletedEvent)
Aborted(DerivedAbortedEvent)
}pub(all) struct DerivedMap[K, V] {
// private fields
}
fn DerivedMap::DerivedMap(rt : Runtime, compute : (K) -> V raise Failure, label? : String) -> DerivedMap[K, V]fn[K : Hash + Eq, V, E] DerivedMap::fallible(rt : Runtime, compute : (K) -> Result[V, E], label? : String) -> DerivedMap[K, Result[V, E]]fn[K : Hash + Eq, V : Eq] DerivedMap::read(self : DerivedMap[K, V], key : K) -> Result[V, ReadError]fn[K : Hash + Eq, V : Eq] DerivedMap::read_or_else(self : DerivedMap[K, V], key : K, fallback : (ReadError) -> V) -> Vpub(all) struct EagerDerived[T] {
// private fields
}
fn EagerDerived::EagerDerived(rt : Runtime, compute : () -> T) -> EagerDerived[T]pub struct Effect {
// private fields
}pub(all) struct FunctionalRelation[K, V] {
// private fields
}
fn FunctionalRelation::FunctionalRelation(rt : Runtime, merge? : (V, V) -> V, label? : String) -> FunctionalRelation[K, V]fn[K : Hash + Eq, V : Eq] FunctionalRelation::insert(self : FunctionalRelation[K, V], key : K, value : V) -> Boolfn[K : Hash + Eq, V] FunctionalRelation::new(rt : Runtime, merge? : (V, V) -> V, label? : String) -> FunctionalRelation[K, V]pub(all) struct HybridMemo[T] {
// private fields
} derive(Debug)
fn HybridMemo::HybridMemo(rt : Runtime, compute : () -> T raise Failure, label? : String) -> HybridMemo[T]fn[T : Eq] HybridMemo::new(rt : Runtime, compute : () -> T raise Failure, label? : String) -> HybridMemo[T]pub(all) struct Input[T] {
// private fields
}
fn Input::Input(rt : Runtime, initial : T, durability? : Durability, label? : String) -> Input[T]pub(all) struct InputField[T] {
// private fields
}
fn InputField::InputField(rt : Runtime, initial : T, durability? : Durability, label? : String) -> InputField[T]pub(all) struct MapRelation[K, V] {
// private fields
}
fn MapRelation::MapRelation(rt : Runtime, merge? : (V, V) -> V, label? : String) -> MapRelation[K, V]let rt = Runtime()
let a = Signal(rt, 10)
let b = Signal(rt, 20)
let sum = Memo(rt, () => a.get() + b.get())
let observer = sum.observe()
inspect(observer.get(), content="30") // Computes and caches
a.set(15)
inspect(observer.get(), content="35") // Recomputes because `a` changed
observer.dispose()let x = Signal(rt, 1)
let m = Memo(rt, () => x.get() * 2)
let observer = m.observe()
observer.get() |> ignore
observer.dispose()
inspect(m.dependencies().contains(x.id()), content="true")match memo.get_result() {
Ok(value) => println("Got: " + value.to_string())
Err(err) => {
println("Cycle at " + err.cell().to_string())
println("Path: " + err.format_path(rt))
}
}fn[T : BackdateEq + HasChangedAt] Memo::new_memo(rt : Runtime, compute : () -> T raise Failure, label? : String) -> Memo[T]let rt = Runtime()
let source = Signal(rt, 10)
let by_id = MemoMap(rt, (id : Int) => source.get() + id)
inspect(by_id.get(1), content="11")
inspect(by_id.get(1), content="11") // cache hit for key=1
inspect(by_id.get(2), content="12") // separate memo for key=2pub(all) struct ReachableDerived[T] {
// private fields
}
fn ReachableDerived::ReachableDerived(rt : Runtime, compute : () -> T raise Failure, label? : String) -> ReachableDerived[T]pub struct Reactive[T] {
// private fields
}let rt = Runtime()
let x = Signal(rt, 10)
let doubled = Memo(rt, () => x.get() * 2)rt.batch(() => {
x.set(10)
y.set(20)
z.set(30)
})
// Single revision bump for all three changesrt.batch(() => {
x.set(5) // Change from 0 to 5
x.set(0) // Change back to 0
})
// No revision bump — net change is zerolet rt = Runtime()
let sig = Signal(rt, 42)
let memo = Memo(rt, () => sig.get() * 2)
let _ = memo.get() // Force computation
// Query signal metadata
match rt.cell_info(sig.id()) {
Some(info) => {
println("Signal changed at: \{info.changed_at}")
println("Dependencies: \{info.dependencies.length()}")
}
None => println("Cell not found")
}
// Query memo metadata
match rt.cell_info(memo.id()) {
Some(info) => {
println("Memo durability: \{info.durability}")
println("Depends on \{info.dependencies.length()} cells")
}
None => println("Cell not found")
}#deprecated("Use Runtime::on_derived_event")
fn Runtime::on_memo_event(self : Runtime, f : (DerivedEvent) -> Unit) -> Unit raise Failure#deprecated("Use target facade read_or_abort()/watch() methods; Runtime::read_hybrid is legacy compatibility")
fn[T : Eq] Runtime::read_hybrid(self : Runtime, memo : HybridMemo[T]) -> Tpub struct Scope {
// private fields
}let scope = Scope::new(rt)
let local = scope.signal(42)
let derived = scope.memo(fn() { local.get() * 2 })
// Component unmounts — one cleanup call
scope.dispose()fn[V : Eq, E : Eq] Scope::accepted_derived(self : Scope, compute : () -> Result[V, E], label? : String) -> AcceptedDerived[V, E]fn[V : BackdateEq + HasChangedAt, E : Eq] Scope::accepted_memo(self : Scope, compute : () -> Result[V, E], label? : String) -> AcceptedDerived[V, E]fn[T : Eq] Scope::hybrid_memo(self : Scope, f : () -> T raise Failure, label? : String) -> HybridMemo[T]fn[T] Scope::input(self : Scope, initial : T, durability? : Durability, label? : String) -> Input[T]fn[T] Scope::input_field(self : Scope, initial : T, durability? : Durability, label? : String) -> InputField[T]fn[T : Eq] Scope::reachable_derived(self : Scope, f : () -> T raise Failure, label? : String) -> ReachableDerived[T]fn[T] Scope::signal(self : Scope, initial : T, durability? : Durability, label? : String) -> Signal[T]pub(all) struct Signal[T] {
// private fields
} derive(Debug)
fn Signal::Signal(rt : Runtime, initial : T, durability? : Durability, label? : String) -> Signal[T]let rt = Runtime()
let count = Signal(rt, 0)
count.set(5)
inspect(count.get(), content="5")let sig = Signal(rt, 42)
let id = sig.id()
match rt.cell_info(id) {
Some(info) => println("Signal changed at: " + info.changed_at.to_string())
None => ()
}fn[T] Signal::new(rt : Runtime, initial : T, durability? : Durability, label? : String) -> Signal[T]let count = Signal(rt, 0)
let config = Signal(rt, "prod", durability=High)
let named = Signal(rt, 0, label="count")let s = Signal(rt, 5)
s.set(5) // No-op: value unchanged, no revision bump
s.set(6) // Bumps revision, memos depending on s will reverifypub(all) struct TrackedCell[T] {
// private fields
} derive(Debug)
fn TrackedCell::TrackedCell(rt : Runtime, initial : T, durability? : Durability, label? : String) -> TrackedCell[T]let rt = Runtime()
let cell = TrackedCell(rt, 0, label="counter")
cell.set(5)
inspect(cell.get(), content="5")fn[T] TrackedCell::new(rt : Runtime, initial : T, durability? : Durability, label? : String) -> TrackedCell[T]let cell = TrackedCell(rt, 42)
let config = TrackedCell(rt, "prod", durability=High)
let named = TrackedCell(rt, 0, label="counter")Install
Download zipSalsa-inspired incremental recomputation library with automatic dependency tracking, backdating, and durability-based verification skipping