[][src]Trait unsafer::pointers::Pointer

pub trait Pointer<T> {
    pub fn as_mut_ptr(&mut self) -> *mut T;
pub fn as_ptr(&self) -> *const T; pub unsafe fn write_with(&mut self, f: impl FnOnce() -> T) { ... } }

Required methods

pub fn as_mut_ptr(&mut self) -> *mut T[src]

Casts a generic pointer into a mutable pointer.

pub fn as_ptr(&self) -> *const T[src]

Casts a generic pointer into a const pointer.

Loading content...

Provided methods

pub unsafe fn write_with(&mut self, f: impl FnOnce() -> T)[src]

Runs f and writes the result into the location.

Safety

Every invariant of write applies to this. Memory behind the pointer must be treated as undefined if f panics.

Loading content...

Implementations on Foreign Types

impl<T> Pointer<T> for *mut T[src]

impl<T> Pointer<T> for *const T[src]

impl<T> Pointer<T> for NonNull<T>[src]

Loading content...

Implementors

Loading content...