pub struct SelfDescPointer<T> { /* private fields */ }Expand description
8-byte pointer with (type_id, layout_shape, address) packed.
Implementations§
Source§impl<T> SelfDescPointer<T>
impl<T> SelfDescPointer<T>
Sourcepub const SIGNATURE: AxisMask
pub const SIGNATURE: AxisMask
Direction signature of SelfDescPointer<T>. Engages the
K_type_tag axis (type-id + layout-shape discriminant
stored at slot for runtime type dispatch without a vtable
indirection).
Sourcepub unsafe fn from_raw(
target: *const T,
type_id: u8,
shape: LayoutShape,
) -> Self
pub unsafe fn from_raw( target: *const T, type_id: u8, shape: LayoutShape, ) -> Self
Construct from raw pointer + type ID + layout shape.
§Safety
target must fit in 53 bits (canonical 48-bit address is
always fine; the top 11 bits MUST be zero). Caller must keep
the target alive for the lifetime of this pointer.
Sourcepub fn layout_shape(&self) -> LayoutShape
pub fn layout_shape(&self) -> LayoutShape
Encoded layout shape.
Sourcepub fn set_type_id(&mut self, new_id: u8)
pub fn set_type_id(&mut self, new_id: u8)
Update type_id in place.
Sourcepub fn set_layout_shape(&mut self, new_shape: LayoutShape)
pub fn set_layout_shape(&mut self, new_shape: LayoutShape)
Update layout_shape in place.
Trait Implementations§
Source§impl<T> Clone for SelfDescPointer<T>
impl<T> Clone for SelfDescPointer<T>
impl<T> Copy for SelfDescPointer<T>
Source§impl<T> Debug for SelfDescPointer<T>
impl<T> Debug for SelfDescPointer<T>
impl<T> Eq for SelfDescPointer<T>
Source§impl<T> Hash for SelfDescPointer<T>
impl<T> Hash for SelfDescPointer<T>
Source§impl<T> PartialEq for SelfDescPointer<T>
impl<T> PartialEq for SelfDescPointer<T>
impl<T: Send> Send for SelfDescPointer<T>
impl<T: Sync> Sync for SelfDescPointer<T>
Auto Trait Implementations§
impl<T> Freeze for SelfDescPointer<T>
impl<T> RefUnwindSafe for SelfDescPointer<T>
impl<T> Unpin for SelfDescPointer<T>
impl<T> UnsafeUnpin for SelfDescPointer<T>
impl<T> UnwindSafe for SelfDescPointer<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more