pub trait RawBorrow<T> {
    // Required method
    unsafe fn raw_borrow<'a>(
        input: *const T
    ) -> Result<&'a Self, UnexpectedNullPointerError>;
}
Expand description

Trait to create borrowed references to type T, from a raw pointer to a T. Note that this is implemented for all types.

Required Methods§

source

unsafe fn raw_borrow<'a>( input: *const T ) -> Result<&'a Self, UnexpectedNullPointerError>

Get a reference on the value behind the pointer or return an error if the pointer is null.

Safety

As this is using *const T::as_ref() this is unsafe for exactly the same reasons.

Implementations on Foreign Types§

source§

impl RawBorrow<i8> for CStr

Implementors§

source§

impl<T> RawBorrow<T> for T

Trait that allows obtaining a borrowed reference to a type T from a raw pointer to T