Trait openexr::core::refptr::OpaquePtr [−][src]
pub unsafe trait OpaquePtr {
type SysPointee;
type Pointee;
}
Expand description
This trait describes the relationship between an opaque pointer to a C++ object and the newtype we use to wrap it in Rust.
This trait is unsafe to implement because the associated types are used as parameters to transmute() in the Ref and RefMut wrappers, so getting this wrong would be very bad.
To be specific, SysPointee
must be the pointee C++ type and Pointee
must
be the newtype wrapper, which must be #[repr(transparent)]
. For example,
for Header
:
#[repr(transparent)] pub struct Header(pub(crate) *mut sys::Imf_Header_t);
the SysPointee
is sys::Imf_Header_t
and Pointee
is Header
and this
is valid because Header
is a transparent newtype of sys::Imf_Header_t