pub trait PtrWrapper: Sized {
type Pointer;
// Required methods
unsafe fn from_raw(raw: *mut Self::Pointer) -> Self;
fn as_ptr(&self) -> *const Self::Pointer;
// Provided methods
fn into_raw(self) -> *mut Self::Pointer { ... }
fn as_ptr_mut(&mut self) -> *mut Self::Pointer { ... }
}Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn into_raw(self) -> *mut Self::Pointer
fn into_raw(self) -> *mut Self::Pointer
Consumes the wrapper and transfers ownershop to the pointer
This does NOT drop the wrapper internally.
Sourcefn as_ptr_mut(&mut self) -> *mut Self::Pointer
fn as_ptr_mut(&mut self) -> *mut Self::Pointer
Returns the inner pointer (mutable version).
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.