Trait foreign_types_shared::ForeignTypeRef

source ·
pub trait ForeignTypeRef: Sized {
    type CType;

    // Provided methods
    unsafe fn from_ptr<'a>(ptr: *mut Self::CType) -> &'a Self { ... }
    unsafe fn from_ptr_mut<'a>(ptr: *mut Self::CType) -> &'a mut Self { ... }
    fn as_ptr(&self) -> *mut Self::CType { ... }
}
Expand description

A trait implemented by types which reference borrowed foreign types.

Required Associated Types§

source

type CType

The raw C type.

Provided Methods§

source

unsafe fn from_ptr<'a>(ptr: *mut Self::CType) -> &'a Self

Constructs a shared instance of this type from its raw type.

source

unsafe fn from_ptr_mut<'a>(ptr: *mut Self::CType) -> &'a mut Self

Constructs a mutable reference of this type from its raw type.

source

fn as_ptr(&self) -> *mut Self::CType

Returns a raw pointer to the wrapped value.

Object Safety§

This trait is not object safe.

Implementors§