pub struct AnyPtr { /* private fields */ }Expand description
A pointer to a Sized type or to a dyn Trait.
modified from: quinedot
Rust has two main type of pointers:
- thin pointer: same size as
usize. we store those directly in.data - fat pointers: they have a
datapointer and avtablepointer.
Unfortunately in fat pointers there is no guerantee on which is first
(data or vtable), so we need to check every time.
We store this information as a 1-byte offset in the .meta field.
Vtable pointers are guaranteed to be word-aligned.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AnyPtr
impl RefUnwindSafe for AnyPtr
impl !Send for AnyPtr
impl !Sync for AnyPtr
impl Unpin for AnyPtr
impl UnwindSafe for AnyPtr
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