Expand description
yse-model is the pure-Rust reactive runtime at the core of Yse.
The design is inspired by Airstream:
EventStreamhas no current value; it carries discrete events.Signalalways has a current value; it carries state.- Propagation is transactional and glitch-free: inside one transaction, derived values are recomputed in topological order, so a diamond-shaped graph never observes inconsistent intermediate state.
- Every observation is owned by a
Subscription; dropping it (directly or through anOwner) unsubscribes.
The crate is pure Rust: no Qt and no unsafe. The reactive graph itself is
single-threaded; background work must return to it through a Scheduler
(see spawn_task).
Structs§
- Cancellation
Token - Cooperative cancellation token shared with a running
Task. - Diagnostics
- Installed diagnostics for the current thread.
- Event
Stream - A stream of discrete events. It has no current value.
- Interval
- Handle to a repeating background sampler started by
spawn_interval. Each sample is delivered to the thread that spawned it through the givenScheduler; subscribe withInterval::results. - List
Model - An incremental list model.
- LogRecord
- A structured log record.
- Logger
- A leveled logger whose records are observable as a stream.
- Manual
Timer - A test
Timerthat queues tasks until the test fires them. - Observer
- A reusable callback handle that can observe several observables at once.
- Owner
- Owns a set of subscriptions and unsubscribes all of them when dropped.
- Queue
Scheduler - A scheduler that queues tasks and runs them on demand on the calling thread. Useful for deterministic tests and for wiring background results into the reactive graph.
- Signal
- A read-only signal with a current value.
- Sink
- A writable source of stream events.
- Subscription
- Handle to an active observation. Dropping it unsubscribes.
- Sync
Scheduler - A scheduler that runs tasks immediately on the current thread.
- Task
- Handle to a background task. The result is delivered to the thread that
spawned the task through the given
Scheduler; subscribe withTask::results. - Undo
Stack - A stack of reversible commands with reactive
can_undo/can_redostate and a change stream. - Var
- A writable source of signal state.
Enums§
- Diagnostic
Event - A transactional graph event.
- List
Change - A structural change to a
ListModel. - LogLevel
- Severity of a log record.
Traits§
- Command
- A reversible operation managed by an
UndoStack. - Scheduler
- Executes deferred work. Yse’s reactive graph is synchronous and single-threaded; this trait is the boundary where background work returns to the UI thread. A scheduler must run scheduled tasks on the thread that owns the reactive graph (the UI thread in a Qt application).
- Timer
- A source of one-shot delayed tasks. Tasks must run on the thread that owns the reactive graph.
Functions§
- log
- Log through the thread’s installed logger; no-op when none is installed.
- log_
debug - Emit a debug record through the thread’s installed logger.
- log_
error - Emit an error record through the thread’s installed logger.
- log_
info - Emit an informational record through the thread’s installed logger.
- log_
warn - Emit a warning record through the thread’s installed logger.
- spawn_
interval - Run
fon a background thread everyinterval, delivering each sample onto the thread that owns the reactive graph viascheduler. - spawn_
task - Run
fon a background thread and deliver its result onto the thread that owns the reactive graph viascheduler. - transaction
- Run
finside a single transaction. Nested calls join the outer transaction.