Function std::ptr::from_ref

1.76.0 (const: 1.76.0) · source ·
pub const fn from_ref<T>(r: &T) -> *const T
where T: ?Sized,
Expand description

Convert a reference to a raw pointer.

This is equivalent to r as *const T, but is a bit safer since it will never silently change type or mutability, in particular if the code is refactored.