Function raw_pointer_as_mut

Source
pub unsafe fn raw_pointer_as_mut<'a, T>(
    ptr: *mut T,
) -> Result<&'a mut T, RawPointerError>
Expand description

Converts a raw pointer to a mutable reference.

§Safety

  • The caller must guarantee that the pointer is valid.
  • The lifetime of the reference must not outlive the pointer’s validity.

§Errors

  • If the pointer is null
  • If the pointer is unaligned