pub struct Ptr<T> { /* private fields */ }Expand description
A transparent wrapper around Option<NonNull<T>> returned by AtomicTaggedPtr operations.
It provides convenient helper methods to convert into raw const/mutable pointers,
access the underlying Option<NonNull<T>>, and supports direct comparisons.
Implementations§
Source§impl<T> Ptr<T>
impl<T> Ptr<T>
Sourcepub const fn new(ptr: Option<NonNull<T>>) -> Self
pub const fn new(ptr: Option<NonNull<T>>) -> Self
Creates a new Ptr wrapper from an Option<NonNull<T>>.
Sourcepub fn as_mut_ptr(self) -> *mut T
pub fn as_mut_ptr(self) -> *mut T
Converts the pointer into a raw mutable pointer *mut T.
Returns a null pointer if the underlying value is None.
Trait Implementations§
Source§impl<T> IntoOptionNonNull<T> for Ptr<T>
impl<T> IntoOptionNonNull<T> for Ptr<T>
Source§fn into_option_non_null(self) -> Option<NonNull<T>>
fn into_option_non_null(self) -> Option<NonNull<T>>
Converts
self into Option<NonNull<T>>.Source§impl<T> PartialEq<NonNull<T>> for Ptr<T>
impl<T> PartialEq<NonNull<T>> for Ptr<T>
Source§impl<T> PartialEq<Option<NonNull<T>>> for Ptr<T>
impl<T> PartialEq<Option<NonNull<T>>> for Ptr<T>
impl<T> Copy for Ptr<T>
impl<T> Eq for Ptr<T>
Auto Trait Implementations§
impl<T> Freeze for Ptr<T>
impl<T> RefUnwindSafe for Ptr<T>where
T: RefUnwindSafe,
impl<T> !Send for Ptr<T>
impl<T> !Sync for Ptr<T>
impl<T> Unpin for Ptr<T>
impl<T> UnsafeUnpin for Ptr<T>
impl<T> UnwindSafe for Ptr<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