pub unsafe trait Raw: Sized {
type Raw: Sized;
// Required methods
unsafe fn from_raw(raw: *mut Self::Raw) -> Self;
unsafe fn from_raw_opt(raw: *mut Self::Raw) -> Option<Self>;
fn into_raw(self) -> *mut Self::Raw;
fn as_raw(&self) -> *mut Self::Raw;
}Expand description
Allow conversion to/from raw (winapi) pointer types.
§⚠️ Safety ⚠️
Lots of code depends on implicit invariants of this trait for soundness:
- Raw::into_raw and Raw::as_raw have sane implementations.
- If Raw::Raw is a winapi::Interface, it too must be “sane” (correct guid, sound implementation of the COM interface in question, etc.)
- Probably more I’m not thinking of
Required Associated Types§
Required Methods§
Sourceunsafe fn from_raw_opt(raw: *mut Self::Raw) -> Option<Self>
unsafe fn from_raw_opt(raw: *mut Self::Raw) -> Option<Self>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".