Function to_raw_parts
pub const fn to_raw_parts<T>(
ptr: *const T,
) -> (*const (), <T as Pointee>::Metadata) ⓘ
Available on crate feature
dep_rkyv
only.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);