/// For more details, see the equivalent method on a raw pointer, [`ptr::without_provenance_mut`].
/// For more details, see the equivalent method on a raw pointer, [`ptr::with_exposed_provenance_mut`].
/// [`with_exposed_provenance`][NonNull::with_exposed_provenance] and returns the "address" portion.
/// For more details, see the equivalent method on a raw pointer, [`pointer::expose_provenance`].
// SAFETY: The result of `ptr::from::with_addr` is non-null because `addr` is guaranteed to be non-zero.
/// Returns a shared reference to the value. If the value may be uninitialized, [`as_uninit_ref`]
/// Returns a unique reference to the value. If the value may be uninitialized, [`as_uninit_mut`]
/// This implies, for instance, that `vec.as_ptr().add(vec.len())` (for `vec: Vec<T>`) is always
/// This implies, for instance, that `vec.as_ptr().add(vec.len())` (for `vec: Vec<T>`) is always
/// Calculates the offset from a pointer in bytes (convenience for `.byte_offset(count as isize)`).
/// This implies, for instance, that `vec.as_ptr().add(vec.len())` (for `vec: Vec<T>`) is always
/// Calculates the distance between two pointers within the same allocation. The returned value is in
/// runtime and may be exploited by optimizations. If you wish to compute the difference between
/// Calculates the distance between two pointers within the same allocation. The returned value is in
// N.B. `wrapping_offset``, `wrapping_add`, etc are not implemented because they can wrap to null
/// Calculates the distance between two pointers within the same allocation, *where it's known that
/// # unsafe fn blah(ptr: std::ptr::NonNull<u32>, origin: std::ptr::NonNull<u32>, count: usize) -> bool { unsafe {
/// Calculates the distance between two pointers within the same allocation, *where it's known that
/// may return `usize::MAX` in cases where that can never happen at runtime. This is because the
/// guaranteed alignment can sometimes not be computed. For example, a buffer declared as `[u8;
/// find an offset that is guaranteed to be 2-aligned. (This behavior is subject to change, as usual
/// assert!(u16_ptr.read() == u16::from_ne_bytes([5, 6]) || u16_ptr.read() == u16::from_ne_bytes([6, 7]));
/// * The total size `ptr.len() * size_of::<T>()` of the slice must be no larger than `isize::MAX`.
/// * The total size `ptr.len() * size_of::<T>()` of the slice must be no larger than `isize::MAX`.
/// // Note that calling `memory.as_mut()` is not allowed here as the content may be uninitialized.
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
impl<T: PointeeSized, U: PointeeSized> CoerceUnsized<NonNull<U>> for NonNull<T> where T: Unsize<U> {}
impl<T: PointeeSized, U: PointeeSized> DispatchFromDyn<NonNull<U>> for NonNull<T> where T: Unsize<U> {}