Function raw_pointer_as_ref

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

Converts a raw pointer to an immutable 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