Function ptr_meta::to_raw_parts

source ·
pub const fn to_raw_parts<T: Pointee + ?Sized>(
    ptr: *const T,
) -> (*const (), <T as Pointee>::Metadata)
Expand description

Returns the data address and metadata of the given pointer.

*mut T, &T, and &mut T can all be passed directly to this function as they implicitly coerce to *const T.

§Example

let (data_address, metadata) = ptr_meta::to_raw_parts("foo");
assert_ne!(data_address, core::ptr::null());
assert_eq!(metadata, 3);