Trait vizia_core::vg::wrapper::PointerWrapper

pub unsafe trait PointerWrapper<N>: 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§

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

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

fn unwrap(self) -> *mut N

Unwraps the wrapper type into the native pointer.

fn inner(&self) -> &N

Access the wrapped pointer.

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

Access the wrapped pointer.

Object Safety§

This trait is not object safe.

Implementors§

§

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

§

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