Skip to main content

ErasedValueBoxPointer

Trait ErasedValueBoxPointer 

Source
pub trait ErasedValueBoxPointer {
    // Required method
    fn with_ptr<R: Any, F>(&self, op: F) -> Result<R>
       where F: FnOnce(NonNull<c_void>) -> Result<R>;

    // Provided method
    fn with_ptr_ok<R: Any, F>(&self, op: F) -> Result<R>
       where F: FnOnce(NonNull<c_void>) -> R { ... }
}

Required Methods§

Source

fn with_ptr<R: Any, F>(&self, op: F) -> Result<R>
where F: FnOnce(NonNull<c_void>) -> Result<R>,

Evaluate a given function with a non-null pointer to the boxed value. The pointer must not outlive the closure.

Provided Methods§

Source

fn with_ptr_ok<R: Any, F>(&self, op: F) -> Result<R>
where F: FnOnce(NonNull<c_void>) -> R,

Evaluate a given function with a non-null pointer to the boxed value. The pointer must not outlive the closure.

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 ErasedValueBoxPointer for *const ErasedValueBox

Source§

fn with_ptr<R: Any, F>(&self, op: F) -> Result<R>
where F: FnOnce(NonNull<c_void>) -> Result<R>,

Source§

impl ErasedValueBoxPointer for *mut ErasedValueBox

Source§

fn with_ptr<R: Any, F>(&self, op: F) -> Result<R>
where F: FnOnce(NonNull<c_void>) -> Result<R>,

Source§

impl<T: Any> ErasedValueBoxPointer for *mut ValueBox<T>

Source§

fn with_ptr<R: Any, F>(&self, op: F) -> Result<R>
where F: FnOnce(NonNull<c_void>) -> Result<R>,

Implementors§