pub unsafe trait SharedPointer<T: Pointee + ?Sized> {
// Required methods
fn alloc(metadata: T::Metadata) -> Result<*mut T, LayoutError>;
unsafe fn from_value(ptr: *mut T) -> *mut T;
unsafe fn drop(ptr: *mut T);
}Expand description
A deserializable shared pointer type.
§Safety
alloc and from_value must return pointers which are non-null, writeable,
and properly aligned for T.
Required Methods§
Sourcefn alloc(metadata: T::Metadata) -> Result<*mut T, LayoutError>
fn alloc(metadata: T::Metadata) -> Result<*mut T, LayoutError>
Allocates space for a value with the given metadata.
Sourceunsafe fn from_value(ptr: *mut T) -> *mut T
unsafe fn from_value(ptr: *mut T) -> *mut T
Creates a new Self from a pointer to a valid T.
§Safety
ptr must have been allocated via alloc. from_value must not have
been called on ptr yet.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".