Trait ValueWrapper
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§
fn wrap(native: N) -> Self
fn unwrap(self) -> N
fn inner(&self) -> &N
fn inner_mut(&mut self) -> &mut N
Object Safety§
This trait is not object safe.