doc.rust-lang.org
pub const fn is_empty(self) -> bool
Returns true if the non-null raw slice has a length of 0.
method
core
Stable since 1.79.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_aligned(self) -> bool
Returns whether the pointer is properly aligned for T.
method
core
Stable since 1.79.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn from_ref(r: &T) -> Self
Converts a reference to a NonNull pointer.
associated_function
core
Stable since 1.89.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn from_mut(r: &mut T) -> Self
Converts a mutable reference to a NonNull pointer.
associated_function
core
Stable since 1.89.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn expose_provenance(self) -> NonZero<usize>
Exposes the "provenance" part of the pointer for future use in with_exposed_provenance and returns the "address" portion.
method
core
Stable since 1.89.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn drop_in_place(self)
Executes the destructor (if any) of the pointed-to value.
method
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn dangling() -> Self
Creates a new NonNull that is dangling, but well-aligned.
associated_function
core
Stable since 1.25.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn copy_to_nonoverlapping(self, dest: NonNull<T>, count: usize)
Copies count * size_of::<T>() bytes from self to dest. The source and destination may not overlap.
method
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn copy_to(self, dest: NonNull<T>, count: usize)
Copies count * size_of::<T>() bytes from self to dest. The source and destination may overlap.
method
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn copy_from_nonoverlapping(self, src: NonNull<T>, count: usize)
Copies count * size_of::<T>() bytes from src to self. The source and destination may not overlap.
method
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn copy_from(self, src: NonNull<T>, count: usize)
Copies count * size_of::<T>() bytes from src to self. The source and destination may overlap.
method
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn cast<U>(self) -> NonNull<U>
Casts to a pointer of another type.
method
core
Stable since 1.27.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn byte_sub(self, count: usize) -> Self
Calculates the offset from a pointer in bytes (convenience for .byte_offset((count as isize).wrapping_neg())).
method
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn byte_offset_from_unsigned<U>(self, origin: NonNull<U>) -> usize
Calculates the distance between two pointers within the same allocation, where it's known that self is equal to or greater than origin. The returned value is in units of bytes.
method
core
Stable since 1.87.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn byte_offset_from<U>(self, origin: NonNull<U>) -> isize
Calculates the distance between two pointers within the same allocation. The returned value is in units of bytes.
method
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn byte_offset(self, count: isize) -> Self
Calculates the offset from a pointer in bytes.
method
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn byte_add(self, count: usize) -> Self
Calculates the offset from a pointer in bytes (convenience for .byte_offset(count as isize)).
method
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn as_ref<'a>(&self) -> &'a T
Returns a shared reference to the value. If the value may be uninitialized, as_uninit_ref must be used instead.
method
core
Stable since 1.25.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_ptr(self) -> *mut T
Acquires the underlying *mut pointer.
method
core
Stable since 1.25.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn as_mut<'a>(&mut self) -> &'a mut T
Returns a unique reference to the value. If the value may be uninitialized, as_uninit_mut must be used instead.
method
core
Stable since 1.25.0
Version 1.100.0-nightly