pub struct NonNullMut<T>(/* private fields */)
where
T: ?Sized;Expand description
A wrapper around NonNull that is explicitly a mut pointer.
Implementations§
Source§impl<T> NonNullMut<T>where
T: ?Sized,
impl<T> NonNullMut<T>where
T: ?Sized,
Sourcepub const fn into_nonnull(self) -> NonNull<T>
pub const fn into_nonnull(self) -> NonNull<T>
Convert into a plain NonNull.
Sourcepub const fn as_nonnull(&self) -> &NonNull<T>
pub const fn as_nonnull(&self) -> &NonNull<T>
Take a reference to the internal NonNull.
Sourcepub const unsafe fn new_unchecked(ptr: *mut T) -> Self
pub const unsafe fn new_unchecked(ptr: *mut T) -> Self
Sourcepub unsafe fn as_mut<'a>(&mut self) -> &'a mut T
pub unsafe fn as_mut<'a>(&mut self) -> &'a mut T
Returns an unique reference to the value.
§Safety
When calling this method, you have to ensure that the pointer is convertible to a reference.
Sourcepub const fn cast<U>(self) -> NonNullMut<U>
pub const fn cast<U>(self) -> NonNullMut<U>
Casts to a pointer of another type.
Sourcepub const fn cast_const(self) -> NonNullConst<T>
pub const fn cast_const(self) -> NonNullConst<T>
Casts to a const pointer of the same type.
Source§impl NonNullMut<c_void>
impl NonNullMut<c_void>
Sourcepub const unsafe fn new_void_unchecked<U>(ptr: *mut U) -> Selfwhere
U: ?Sized,
pub const unsafe fn new_void_unchecked<U>(ptr: *mut U) -> Selfwhere
U: ?Sized,
Creates a new NonNullMut, casting the passsed pointer to void
pointer.
§Safety
ptr must be non-null.
Trait Implementations§
Source§impl<T> Clone for NonNullMut<T>where
T: ?Sized,
impl<T> Clone for NonNullMut<T>where
T: ?Sized,
Source§impl<T> Debug for NonNullMut<T>where
T: ?Sized,
impl<T> Debug for NonNullMut<T>where
T: ?Sized,
Source§impl<T> Hash for NonNullMut<T>where
T: ?Sized,
impl<T> Hash for NonNullMut<T>where
T: ?Sized,
Source§impl<T> Ord for NonNullMut<T>where
T: ?Sized,
impl<T> Ord for NonNullMut<T>where
T: ?Sized,
Source§impl<T> PartialEq for NonNullMut<T>where
T: ?Sized,
impl<T> PartialEq for NonNullMut<T>where
T: ?Sized,
Source§impl<T> PartialOrd for NonNullMut<T>where
T: ?Sized,
impl<T> PartialOrd for NonNullMut<T>where
T: ?Sized,
Source§impl<T> Pointer for NonNullMut<T>where
T: ?Sized,
impl<T> Pointer for NonNullMut<T>where
T: ?Sized,
impl<T> Copy for NonNullMut<T>where
T: ?Sized,
impl<T> Eq for NonNullMut<T>where
T: ?Sized,
Auto Trait Implementations§
impl<T> Freeze for NonNullMut<T>where
T: ?Sized,
impl<T> RefUnwindSafe for NonNullMut<T>where
T: RefUnwindSafe + ?Sized,
impl<T> !Send for NonNullMut<T>
impl<T> !Sync for NonNullMut<T>
impl<T> Unpin for NonNullMut<T>where
T: ?Sized,
impl<T> UnwindSafe for NonNullMut<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