skia_safe::wrapper

Trait ValueWrapper

Source
pub unsafe trait ValueWrapper<N> {
    // Required methods
    fn wrap(native: N) -> Self;
    fn unwrap(self) -> N;
    fn inner(&self) -> &N;
    fn inner_mut(&mut self) -> &mut N;
}
Expand description

A trait that supports the conversion from a C/C++ value into its Rust wrapper and back.

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

This trait is implemented for all wrapper types that manage C++/C values in Rust without an pointer indirection.

§Safety

The native type 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 a wrapped value may lose the automatic ability to free associated memory.

Required Methods§

Source

fn wrap(native: N) -> Self

Source

fn unwrap(self) -> N

Source

fn inner(&self) -> &N

Source

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

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> ValueWrapper<N> for Handle<N>
where N: NativeDrop,