pub struct Scheduler {
pub focused: Option<u64>,
pub size: (u32, u32),
/* private fields */
}Fields§
§focused: Option<u64>§size: (u32, u32)Implementations§
Source§impl Scheduler
impl Scheduler
pub fn new() -> Self
Sourcepub fn enter_scope(&mut self, key: &str)
pub fn enter_scope(&mut self, key: &str)
Enter a named scope. Subsequent id() calls within this scope
will allocate from the scope’s local counter, producing packed
(scope_id << 32) | local_id values that are stable across sibling
recompositions. Nested scopes push; exit_scope pops.
Sourcepub fn exit_scope(&mut self)
pub fn exit_scope(&mut self)
Exit the innermost scope. No-op if the stack is empty or the top does not match (defensive: never corrupt an outer scope).
Sourcepub fn scope_guard<'a>(&'a mut self, key: &str) -> SchedulerScopeGuard<'a>
pub fn scope_guard<'a>(&'a mut self, key: &str) -> SchedulerScopeGuard<'a>
RAII scope entry: pops on drop, so a panicking scope body cannot leave the scheduler stuck in the wrong scope (which previously leaked outer IDs into the global sequence).
Sourcepub fn scope_guard_raw(&mut self, key: &str) -> SchedulerScopeGuardRaw
pub fn scope_guard_raw(&mut self, key: &str) -> SchedulerScopeGuardRaw
Panic-safe scope entry that does NOT hold a borrow: the guarded body
(including nested scope!) can keep using the Scheduler. Used by
the scope! macro.
pub fn id(&mut self) -> u64
pub fn id_count(&self) -> u64
Sourcepub fn snapshot_id(&self) -> u64
pub fn snapshot_id(&self) -> u64
Snapshot the current ID counter (before executing a scope body) so the delta can be computed after the body returns.
Sourcepub fn advance_id(&mut self, count: u32)
pub fn advance_id(&mut self, count: u32)
Advance the ID counter by count without assigning IDs.
Used by the scope! macro to reserve IDs for a cached scope subtree.
Sourcepub fn ids_used_since(&self, prev_id: u64) -> u32
pub fn ids_used_since(&self, prev_id: u64) -> u32
Number of IDs assigned since prev_id (the value returned by
snapshot_id() before executing a scope body).