dowdiness/incr/cells does not have a README file
match memo.get_result() {
Ok(value) => println("Got: " + value.to_string())
Err(err) => {
println("Cycle at cell " + err.cell().to_string())
println(err.format_path())
}
}pub(all) enum AcceptStatus {
NoAccept
AcceptedChanged
AcceptedUnchanged
RetainedDueToError
} derive(Eq)impl Show for AcceptStatuspub struct AcceptedDerived[V, E] {
// private fields
}fn[V : Eq, E : Eq] 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
}pub(all) struct Derived[T] {
// private fields
}impl InputFieldOwner for Derived[T]fn[T, A] Derived::accumulated_or_abort(self : Derived[T], acc : Accumulator[A]) -> Array[A] raise Failurefn[T : BackdateEq + HasChangedAt] Derived::with_backdate(rt : Runtime, compute : () -> T raise Failure, label? : String) -> Derived[T]pub(all) enum DerivedEvent {
EnteringCompute(DerivedEnteringEvent)
Completed(DerivedCompletedEvent)
Aborted(DerivedAbortedEvent)
}pub(all) struct DerivedMap[K, V] {
// private fields
}fn[K : Hash + Eq, V] 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
}impl InputFieldOwner for EagerDerived[T]pub struct Effect {
// private fields
}impl InputFieldOwner for Effectpub(all) struct Expr[T] {
// private fields
}let rt = Runtime()
let count = Input(rt, 0)
count.set(5)
inspect(count.get(), content="5")impl InputFieldOwner for Input[T]fn[T] Input::Input(rt : Runtime, initial : T, durability? : Durability, label? : String) -> Input[T]let count = Input(rt, 0)
let config = Input(rt, "prod", durability=High)
let named = Input(rt, 0, label="count")let input = Input(rt, 42)
let view = input[:]
let doubled = Derived(rt, () => view.get() * 2)
input.set(21)
inspect(doubled.read_or_abort(), content="42")let inp = Input(rt, 42)
let id = inp.id()
match rt.cell_info(id) {
Some(info) => println("Input changed at: " + info.changed_at.to_string())
None => ()
}#deprecated("Use the constructor form `Input(rt, initial)` (`Input::Input`) instead.")
fn[T] Input::new(rt : Runtime, initial : T, durability? : Durability, label? : String) -> Input[T]let s = Input(rt, 5)
s.set(5) // No-op: value unchanged, no revision bump
s.set(6) // Bumps revision, deriveds depending on s will reverifylet rt = Runtime()
let field = InputField(rt, 0, label="counter")
field.set(5)
inspect(field.get(), content="5")impl InputFieldOwner for InputField[T]fn[T] InputField::InputField(rt : Runtime, initial : T, durability? : Durability, label? : String) -> InputField[T]let field = InputField(rt, 42)
let config = InputField(rt, "prod", durability=High)
let named = InputField(rt, 0, label="counter")#alias("_[_:_]")
fn[T] InputField::as_view(self : InputField[T], start? : Unit, end? : Unit) -> InputView[T]pub(all) struct InputView[T] {
// private fields
}pub(all) struct MapRelation[K, V] {
// private fields
}fn[K : Hash + Eq, V] MapRelation::MapRelation(rt : Runtime, merge? : (V, V) -> V, label? : String) -> MapRelation[K, V]impl InputFieldOwner for ReachableDerived[T]fn[T : Eq] ReachableDerived::ReachableDerived(rt : Runtime, compute : () -> T raise Failure, label? : String) -> ReachableDerived[T]pub(all) struct Relation[T] {
// private fields
}pub(all) struct Runtime {
// private fields
}let rt = Runtime()
let x = Input(rt, 10)
let doubled = Memo(rt, () => x.get() * 2)fn Runtime::add_derived_event_listener(self : Runtime, f : (DerivedEvent) -> Unit) -> ListenerId raise Failurert.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 = Input(rt, 42)
let derived = Derived(rt, fn() { sig.get() * 2 })
let _ = derived.read_or_abort() // Force computation
// Query input metadata
match rt.cell_info(sig.id()) {
Some(info) => {
println("Input changed at: \{info.changed_at}")
println("Dependencies: \{info.dependencies.length()}")
}
None => println("Cell not found")
}
// Query derived metadata
match rt.cell_info(derived.id()) {
Some(info) => {
println("Derived durability: \{info.durability}")
println("Depends on \{info.dependencies.length()} cells")
}
None => println("Cell not found")
}fn[T] Runtime::input(self : Runtime, initial : T, durability? : Durability, label? : String) -> Input[T]pub struct Scope {
// private fields
}let scope = Scope::new(rt)
let local = scope.input(42)
let derived = scope.derived(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]let scope = Scope::new(rt)
let base = scope.derived(fn() { 42 })
let d = base.map(fn(v) { v + 1 })
scope.adopt(d)
scope.dispose() // d is disposedfn[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]let scope = Scope::new(rt)
let listener_id = rt.add_on_change_listener(() => sync())
scope.on_dispose(() => {
rt.remove_on_change_listener(listener_id)
})fn[T : Eq] Scope::reachable_derived(self : Scope, f : () -> T raise Failure, label? : String) -> ReachableDerived[T]Salsa-inspired incremental recomputation library with automatic dependency tracking, backdating, and durability-based verification skipping
Dependencies