Skip to main content

ArcFromCallbackHandle

Trait ArcFromCallbackHandle 

Source
pub trait ArcFromCallbackHandle {
    // Required method
    unsafe fn arc_from_callback_handle(handle: CallbackHandle) -> Arc<Self>;
}
Expand description

Rebuilds shared callback ownership from a raw CallbackHandle.

Generated bindings use this trait for callback wrappers that are held behind Arc and may be cloned across the boundary.

§Safety

handle must come from the matching generated foreign callback type. Passing a handle created for a different callback wrapper, or reusing a handle after its ownership was already consumed, is undefined behavior.

Required Methods§

Source

unsafe fn arc_from_callback_handle(handle: CallbackHandle) -> Arc<Self>

Rebuilds shared ownership of a callback wrapper from a raw callback handle.

The handle parameter must identify a live callback wrapper of the implementing type. Implementations reconstruct Arc<Self> without allocating a new callback object, so the returned value shares the same callback state that originally crossed the boundary.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§