pub unsafe trait CallbackPolicy: 'static {
type Cell<T>;
type Owner<T>: Deref<Target = Self::Cell<T>> + Clone;
type Guard<'a, T: 'a>: DerefMut<Target = T>;
// Required methods
fn new<T>(value: T) -> Self::Cell<T>;
fn new_owned<T>(value: T) -> Self::Owner<T>;
fn lock<T>(cell: &Self::Cell<T>) -> Self::Guard<'_, T>;
fn is_in_use<T>(cell: &Self::Cell<T>) -> bool;
}Expand description
Callback storage is selected at compile time. There is no trait-object call.
§Safety
Cloning an Owner<T> must keep the same Cell<T> allocation alive. Its address
is passed to C, which may keep it until the last registered handler is removed.
lock must prevent overlapping mutable access to that cell.
Required Associated Types§
type Cell<T>
Sourcetype Owner<T>: Deref<Target = Self::Cell<T>> + Clone
type Owner<T>: Deref<Target = Self::Cell<T>> + Clone
Clones keep the same callback allocation alive while C holds its raw pointer.
type Guard<'a, T: 'a>: DerefMut<Target = T>
Required Methods§
fn new<T>(value: T) -> Self::Cell<T>
fn new_owned<T>(value: T) -> Self::Owner<T>
fn lock<T>(cell: &Self::Cell<T>) -> Self::Guard<'_, T>
fn is_in_use<T>(cell: &Self::Cell<T>) -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".