pub trait ForeignTypeRef: Sized {
type CType;
// Provided methods
unsafe fn from_ptr<'a>(ptr: *mut Self::CType) -> &'a Self { ... }
unsafe fn from_ptr_mut<'a>(ptr: *mut Self::CType) -> &'a mut Self { ... }
fn as_ptr(&self) -> *mut Self::CType { ... }
}
Expand description
A trait implemented by types which reference borrowed foreign types.
Required Associated Types§
Provided Methods§
Sourceunsafe fn from_ptr<'a>(ptr: *mut Self::CType) -> &'a Self
unsafe fn from_ptr<'a>(ptr: *mut Self::CType) -> &'a Self
Constructs a shared instance of this type from its raw type.
Sourceunsafe fn from_ptr_mut<'a>(ptr: *mut Self::CType) -> &'a mut Self
unsafe fn from_ptr_mut<'a>(ptr: *mut Self::CType) -> &'a mut Self
Constructs a mutable reference of this type from its raw type.
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.