from_mut in std::ptr - Rust
Description: Convert a mutable reference to a raw pointer.

# Function std::ptr::from_mut

source ·

    pub const fn from_mut<T>(r: &mut T) -> *mut Twhere
        T: ?Sized,

🔬This is a nightly-only experimental API. (`ptr_from_ref` #106116)
Expand description

Convert a mutable reference to a raw pointer.

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