euv_engine/scheduler/type.rs
1use super::*;
2
3/// A reference-counted shared-mutable container for a `dyn TickHandler`.
4///
5/// Holds a `dyn TickHandler` behind `EngineCell` (an `UnsafeCell`-backed
6/// `Sync` newtype), so the multi-owner shared-mut pattern that
7/// `Rc<RefCell<T>>` used to express is now expressed without `RefCell` -
8/// matching the rest of the engine's `static mut` convention.
9///
10/// # Access
11///
12/// Use [`EngineCell::get_mut`] for unconditional mutable access.
13pub type TickHandlerRc = Rc<EngineCell<dyn TickHandler>>;
14
15/// A reference-counted `requestAnimationFrame` closure cell.
16///
17/// Holds an `Option<Closure<dyn FnMut()>>` behind `MaybeEngineCell` so
18/// the cell may legitimately be empty (no closure installed) before
19/// `spawn` is called and after cleanup tears it down. Mirrors
20/// `core::reactive::schedule::static::CURRENT_HOOK_CONTEXT` in shape.
21///
22/// # Access
23///
24/// Use [`MaybeEngineCell::try_get_mut`] for absent-or-present read,
25/// [`MaybeEngineCell::try_set`] to install, [`MaybeEngineCell::try_take`]
26/// to remove.
27pub type RafClosureCell = Rc<MaybeEngineCell<Closure<dyn FnMut()>>>;