Trait ToHandle

Source
pub trait ToHandle {
    type Handle: Deref;

    // Required method
    unsafe fn to_handle(x: *const Self) -> Self::Handle;
}
Expand description

Trait to implement the conversion of owner to handle for common types.

Required Associated Types§

Source

type Handle: Deref

The type of handle to be encapsulated by the OwningHandle.

Required Methods§

Source

unsafe fn to_handle(x: *const Self) -> Self::Handle

Given an appropriately-long-lived pointer to ourselves, create a handle to be encapsulated by the OwningHandle.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: 'static> ToHandle for RefCell<T>

Source§

type Handle = Ref<'static, T>

Source§

unsafe fn to_handle(x: *const Self) -> Self::Handle

Implementors§