skia_safe::wrapper

Trait PointerWrapper

Source
pub unsafe trait PointerWrapper<N>
where Self: Sized,
{ // Required methods fn wrap(ptr: *mut N) -> Option<Self>; fn unwrap(self) -> *mut N; fn inner(&self) -> &N; fn inner_mut(&mut self) -> &mut N; }
Expand description

This trait supports the conversion of a wrapper into it’s wrapped C/C++ pointer and back.

The wrapped value can be accessed through the functions inner and inner_mut.

§Safety

The native value N should be treated as opaque, because its definition may change without adhering to semantic versioning and depends on what the tool bindgen is able to generate.

Converting from a Rust wrapper to the wrapped value loses the automatic ability to free associated resources.

Required Methods§

Source

fn wrap(ptr: *mut N) -> Option<Self>

Wraps a native pointer into a wrapper type. Returns None if the pointer is null.

Source

fn unwrap(self) -> *mut N

Unwraps the wrapper type into the native pointer.

Source

fn inner(&self) -> &N

Access the wrapped pointer.

Source

fn inner_mut(&mut self) -> &mut N

Access the wrapped pointer.

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§

Source§

impl<N> PointerWrapper<N> for RCHandle<N>
where N: NativeRefCounted,

Source§

impl<N> PointerWrapper<N> for RefHandle<N>
where N: NativeDrop,