devela::_dep::rkyv::ptr_meta

Function metadata

pub const fn metadata<T>(ptr: *const T) -> <T as Pointee>::Metadata
where T: Pointee + ?Sized,
Available on crate feature dep_rkyv only.
Expand description

Returns the 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

// String slices have pointer metadata equal to their size in bytes
assert_eq!(ptr_meta::metadata("foo"), 3_usize);