pub struct Ptr<'a, T>where
T: 'a + ?Sized,{ /* private fields */ }Expand description
A raw pointer with more restrictions.
Ptr<T> is similar to NonNull<T>, but it is more restrictive in the
following ways:
- It must derive from a valid allocation
- It must reference a byte range which is contained inside the
allocation from which it derives
- As a consequence, the byte range it references must have a size
which does not overflow
isize
- As a consequence, the byte range it references must have a size
which does not overflow
- It must satisfy
T’s alignment requirement
Thanks to these restrictions, it is easier to prove the soundness of
some operations using Ptrs.
Ptr<'a, T> is covariant in 'a and T.
Trait Implementations§
impl<'a, T> Copy for Ptr<'a, T>where
T: ?Sized,
Auto Trait Implementations§
impl<'a, T: ?Sized> Freeze for Ptr<'a, T>
impl<'a, T: ?Sized> RefUnwindSafe for Ptr<'a, T>where
T: RefUnwindSafe,
impl<'a, T> !Send for Ptr<'a, T>
impl<'a, T> !Sync for Ptr<'a, T>
impl<'a, T: ?Sized> Unpin for Ptr<'a, T>
impl<'a, T: ?Sized> UnwindSafe for Ptr<'a, 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