pub struct Runtime { /* private fields */ }Expand description
This thread’s reactive runtime.
There is one per thread, created on first use. In the shell that is the
main thread. A Runtime value is only a handle to it, so
Runtime::current is cheap and every copy refers to the same runtime.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn new_owner(&self) -> Owner
pub fn new_owner(&self) -> Owner
Creates a root owner: one with no parent, freed only by its own
Owner::dispose.
Sourcepub fn flush(&self)
pub fn flush(&self)
Runs every queued effect. The event loop calls this once per iteration, before layout and painting.
Each round runs the queued effects once each, in creation order, so an
effect reached through several paths (a diamond) still runs once.
Effects queued during a round, because an effect wrote a signal they
read or was just created, run in the next round of the same flush. An
effect that has run MAX_RUNS_PER_FLUSH times in this flush and is
queued again is in a cycle: it is logged with its debug name and
disabled, and the flush carries on with the other effects.
Calling flush from inside an effect does nothing: the flush that is
already running picks up whatever got queued.
§Panics
Inside a memo, which must not run effects in the middle of its computation.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
The number of live nodes (owners, signals, memos and effects) on this thread. Tests use it to check that disposing an owner frees everything created under it.