pub struct GuardStoreHandle { /* private fields */ }Expand description
Cheap-clone, thread-safe handle to a GuardStore. The App
owns one; the dispatcher clones it into each spawned
lifecycle task so the task can lock + insert the Guard on
completion. Locks are held briefly (single map mutation per
activation / deactivation); std::sync::Mutex is correct
because no .await happens inside the lock.
Implementations§
Source§impl GuardStoreHandle
impl GuardStoreHandle
Sourcepub fn insert(&self, buffer: BufferId, mode: ModeId, guard: Box<dyn Any + Send>)
pub fn insert(&self, buffer: BufferId, mode: ModeId, guard: Box<dyn Any + Send>)
Stash a Guard unconditionally (skipping the epoch
check). Used in tests + the rare reload path; the
production dispatcher routes through
Self::try_insert.
Sourcepub fn bump_epoch(&self, buffer: BufferId, mode: ModeId) -> u64
pub fn bump_epoch(&self, buffer: BufferId, mode: ModeId) -> u64
Bump + return the new epoch for (buffer, mode). The
dispatcher’s sync prefix calls this when queueing each
cascade step; the spawn task captures it and passes
back to Self::try_insert.
Sourcepub fn try_insert(
&self,
buffer: BufferId,
mode: ModeId,
my_epoch: u64,
guard: Box<dyn Any + Send>,
) -> Result<(), Box<dyn Any + Send>>
pub fn try_insert( &self, buffer: BufferId, mode: ModeId, my_epoch: u64, guard: Box<dyn Any + Send>, ) -> Result<(), Box<dyn Any + Send>>
Insert iff my_epoch still matches the current
epoch. Returns Err(guard) on stale; the caller drops
the Guard outside the lock so the original type’s
Drop fires.
Sourcepub fn remove(
&self,
buffer: BufferId,
mode: ModeId,
) -> Option<Box<dyn Any + Send>>
pub fn remove( &self, buffer: BufferId, mode: ModeId, ) -> Option<Box<dyn Any + Send>>
Take ownership of the Guard. Bumps the epoch
(invalidating any in-flight spawn) then removes; the
caller drops the returned Box, firing the Guard’s
Drop impl outside the lock.
Sourcepub fn purge_buffer(&self, buffer: BufferId)
pub fn purge_buffer(&self, buffer: BufferId)
Drop every Guard for buffer. Used when a buffer is
deleted.
Trait Implementations§
Source§impl Clone for GuardStoreHandle
impl Clone for GuardStoreHandle
Source§fn clone(&self) -> GuardStoreHandle
fn clone(&self) -> GuardStoreHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more