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> Freeze for Ptr<'a, T>where
T: ?Sized,
impl<'a, T> RefUnwindSafe for Ptr<'a, T>where
T: RefUnwindSafe + ?Sized,
impl<'a, T> !Send for Ptr<'a, T>
impl<'a, T> !Sync for Ptr<'a, T>
impl<'a, T> Unpin for Ptr<'a, T>where
T: ?Sized,
impl<'a, T> UnwindSafe for Ptr<'a, T>where
T: RefUnwindSafe + ?Sized,
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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)