pub struct Pointer<T> { /* private fields */ }Expand description
A pointer to some T in the GC heap.
§Safety
A Pointer<T> is a small step up in safety from a raw pointer. A valid
Pointer<T> instance is a guarantee that:
-
The pointer points into the GC heap, within a GC-allocated page, and not on top of the
PageHeader. -
The pointer has the alignment required by the type and GC.
Note that Pointer<T> does not pin its referent like GcRef<T>
does. Therefore, a Pointer<T> can still easily be made to dangle or point
at uninitialized memory! The Pointer<T> type is not for general use (use
GcRef<T> for that instead), only for GC internals. We have to make it
pub so that #[derive(IntoHeap)] can generate code that uses it, but no
one else should!
Implementations§
Trait Implementations§
Source§impl<T> From<Pointer<T>> for UntypedPointer
impl<T> From<Pointer<T>> for UntypedPointer
Source§fn from(p: Pointer<T>) -> UntypedPointer
fn from(p: Pointer<T>) -> UntypedPointer
Converts to this type from the input type.
Source§impl<T: Ord> Ord for Pointer<T>
impl<T: Ord> Ord for Pointer<T>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd> PartialOrd for Pointer<T>
impl<T: PartialOrd> PartialOrd for Pointer<T>
impl<T> Copy for Pointer<T>
impl<T> Eq for Pointer<T>
Auto Trait Implementations§
impl<T> Freeze for Pointer<T>
impl<T> RefUnwindSafe for Pointer<T>where
T: RefUnwindSafe,
impl<T> !Send for Pointer<T>
impl<T> !Sync for Pointer<T>
impl<T> Unpin for Pointer<T>
impl<T> UnwindSafe for Pointer<T>where
T: RefUnwindSafe,
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