pub unsafe trait Pointer<T> where
    Self: Sized + Deref<Target = T>, 
{ fn into_raw(self) -> *mut T;
unsafe fn from_raw(ptr: *mut T) -> Self; }
Expand description

A type that can be turned into, and converted from, a raw pointer whose referent is T.

Safety

  1. the *mut T returned from into_raw must be valid as a &mut T when it is returned.
  2. the *mut T returned from into_raw must remain valid as a &T until it is passed to from_raw.
  3. from_raw must not return a particular *mut T again until the provided self is dropped after an eventual call to from_raw.

Required methods

Extract the raw pointer referenced by self.

Reconstruct this pointer type from the given ptr.

Safety (for callers)
  1. ptr must be a pointer returned by Self::into_raw
  2. ptr must be valid to dereference to a T
  3. ptr must not have been passed to from_raw since it was returned from into_raw
  4. ptr must not be aliased

Implementations on Foreign Types

Implementors