/// Convert pointer to ref, emit error if null
Convert pointer to ref, emit error if null
Convert pointer to ref emit error if null
pub(crate) fn ptr_as_ref<'a, T>(ptr: *const T) -> Result<&'a T> {
  match unsafe { ptr.as_ref() } {
    Some(t) => Ok(t),
    None => Err("Null pointer".to_string().into()),
  }
}
pub ( crate ) fn ptr_as_ref < ' a , T > ( ptr : * const T ) -> Result < & ' a T > { match unsafe { ptr . as_ref ( ) } { Some ( t ) => Ok ( t ) , None => Err ( " " . to_string ( ) . into ( ) ) , } }
Convert pointer to ref, emit error if null
Convert pointer to ref emit error if null
ptr
*const T