pub struct TickCallbackRegistry { /* private fields */ }Expand description
Registry of mode-contributed per-tick drain closures.
Stored behind an Arc and shared by reference: the host calls
run_all once per tick; modes
register during Mode::on_activate and
unregister via the returned TickCallbackRegistration token’s
Drop.
Implementations§
Source§impl TickCallbackRegistry
impl TickCallbackRegistry
Sourcepub fn register(
self: &Arc<Self>,
callback: TickCallback,
) -> TickCallbackRegistration
pub fn register( self: &Arc<Self>, callback: TickCallback, ) -> TickCallbackRegistration
Register a per-tick drain closure. Returns an RAII registration
token; dropping it removes the closure. Modes accumulate the
token in their Guard so deactivation drops it and the per-tick
drain stops naturally.
Sourcepub fn run_all(&self) -> Vec<Effect>
pub fn run_all(&self) -> Vec<Effect>
Run every registered callback once, in registration order, and
return the concatenated Effects for the host to apply. Called
once per editor tick from Editor::run_tick_pending.
Holds the lock for the duration: a callback MUST NOT call
register / drop a TickCallbackRegistration on this same
registry from inside its body (it would deadlock). Drain
closures only ever touch their own channel + return effects, so
this is a documented non-constraint in practice.