Trait ProtocolPointer

Source
pub trait ProtocolPointer: Protocol {
    // Required methods
    unsafe fn ptr_from_ffi(ptr: *const c_void) -> *const Self;
    unsafe fn mut_ptr_from_ffi(ptr: *mut c_void) -> *mut Self;
}
Expand description

Trait for creating a protocol pointer from a c_void pointer.

There is a blanket implementation for all Sized protocols that simply casts the pointer to the appropriate type. Protocols that are not sized must provide a custom implementation.

Required Methods§

Source

unsafe fn ptr_from_ffi(ptr: *const c_void) -> *const Self

Create a const pointer to a Protocol from a c_void pointer.

§Safety

The input pointer must point to valid data.

Source

unsafe fn mut_ptr_from_ffi(ptr: *mut c_void) -> *mut Self

Create a mutable pointer to a Protocol from a c_void pointer.

§Safety

The input pointer must point to valid data.

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.

Implementors§