pub struct AsyncCompletionHandle { /* private fields */ }Expand description
Main-thread registry of pending async completions. Clone shares the same
inner state (Rc), so the executor and the app event loop both hold a
handle to one registry. !Send by construction — completions only ever run
on the UI thread.
Implementations§
Source§impl AsyncCompletionHandle
impl AsyncCompletionHandle
pub fn new() -> Self
Sourcepub fn register(
&self,
window_id: TeksiloWindowId,
callback: Box<dyn FnOnce(&mut EventContext<'_>)>,
) -> u64
pub fn register( &self, window_id: TeksiloWindowId, callback: Box<dyn FnOnce(&mut EventContext<'_>)>, ) -> u64
Register a callback to run later with a fresh EventContext on the
tree of window_id. Returns the id to place in an
AsyncCompletionPayload.
Sourcepub fn deliver(
&self,
id: u64,
window_id: TeksiloWindowId,
ctx: &mut EventContext<'_>,
)
pub fn deliver( &self, id: u64, window_id: TeksiloWindowId, ctx: &mut EventContext<'_>, )
Invoke and remove the completion registered under id, if its target
window still matches window_id. Called by teksilo-app from inside
WidgetTree::run_with_event_context.
A no-op if the entry was already purged (e.g. the window closed) — the
use-after-free guard.
Sourcepub fn purge_window(&self, window_id: TeksiloWindowId)
pub fn purge_window(&self, window_id: TeksiloWindowId)
Drop every pending completion targeting window_id. Called when a
window closes so a late-arriving completion never touches a torn-down
tree.
Sourcepub fn pending_len(&self) -> usize
pub fn pending_len(&self) -> usize
Number of pending completions (diagnostics / tests).
Trait Implementations§
Source§impl Clone for AsyncCompletionHandle
impl Clone for AsyncCompletionHandle
Source§fn clone(&self) -> AsyncCompletionHandle
fn clone(&self) -> AsyncCompletionHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more