On this page
Function std::ptr::from_ref
pub const fn from_ref<T>(r: &T) -> *const T
where
T: ?Sized,
🔬This is a nightly-only experimental API. (
ptr_from_ref
#106116)
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.
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/ptr/fn.from_ref.html