pub unsafe trait ObjectCoreWithExtraItems: ObjectCore {
type ExtraItem;
// Required method
fn extra_items_count(this: &Self) -> usize;
// Provided methods
unsafe fn extra_items_ptr(this: *mut Self) -> *mut Self::ExtraItem { ... }
unsafe fn extra_items<'a>(this: *const Self) -> &'a [Self::ExtraItem] { ... }
}Expand description
An object type whose allocation is followed by a run of extra items, such
as the dimensions of a Shape.
The items lie past Self, so a pointer to them is derived from a pointer
to the whole allocation, such as ObjectArc::as_ptr, never from a
&Self, which covers Self only.
§Safety
Every allocation of Self is followed by extra_items_count ExtraItems,
as ObjectArc::new_with_extra_items lays them out. The count stays the
same for the object’s life, and the items are never dropped.
Required Associated Types§
Required Methods§
Sourcefn extra_items_count(this: &Self) -> usize
fn extra_items_count(this: &Self) -> usize
The number of extra items.
Provided Methods§
Sourceunsafe fn extra_items_ptr(this: *mut Self) -> *mut Self::ExtraItem
unsafe fn extra_items_ptr(this: *mut Self) -> *mut Self::ExtraItem
A pointer to the first extra item.
§Safety
this points to an allocation that carries its extra items, and its
provenance covers them.
Sourceunsafe fn extra_items<'a>(this: *const Self) -> &'a [Self::ExtraItem]
unsafe fn extra_items<'a>(this: *const Self) -> &'a [Self::ExtraItem]
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".