Skip to main content

ForeignType

Trait ForeignType 

Source
pub trait ForeignType: Sized {
    type CType;
    type Ref: ForeignTypeRef<CType = Self::CType>;

    // Required methods
    unsafe fn from_ptr(ptr: *mut Self::CType) -> Self;
    fn as_ptr(&self) -> *mut Self::CType;
}
Expand description

A type implemented by wrappers over foreign types.

Required Associated Types§

Source

type CType

The raw C type.

Source

type Ref: ForeignTypeRef<CType = Self::CType>

The type representing a reference to this type.

Required Methods§

Source

unsafe fn from_ptr(ptr: *mut Self::CType) -> Self

Constructs an instance of this type from its raw type.

Source

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

Returns a raw pointer to the wrapped value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§