Skip to main content

SharedEventCallback

Type Alias SharedEventCallback 

Source
pub type SharedEventCallback = Rc<UnsafeCell<Box<dyn FnMut(Event)>>>;
Expand description

Type alias for the shared, interior-mutable storage of an event callback.

Uses Rc<UnsafeCell<>> instead of Rc<RefCell<>> to avoid runtime borrow checking overhead in the single-threaded WASM context. The Rc provides automatic deallocation when the last reference drops.

SAFETY: Only accessed from the main thread in the WASM single-threaded context; no concurrent access is possible.

Aliased Typeยง

pub struct SharedEventCallback { /* private fields */ }