CType

Trait CType 

Source
pub unsafe trait CType: Copy {
    // Required method
    fn reify() -> Type<Self>;
}
Expand description

Types that we can automatically marshall to/from C.

In particular, for any type T that implements CType, we can get a Type<T> for describing that type. This trait is unsafe to implement because if the libffi type associated with a Rust type doesn’t match then we get undefined behavior.

Required Methods§

Source

fn reify() -> Type<Self>

Creates or retrieves a Type<T> for any type T: CType.

We can use the resulting object to assemble a CIF to set up a call that uses type T.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl CType for f32

Source§

fn reify() -> Type<Self>

Source§

impl CType for f64

Source§

fn reify() -> Type<Self>

Source§

impl CType for i8

Source§

fn reify() -> Type<Self>

Source§

impl CType for i16

Source§

fn reify() -> Type<Self>

Source§

impl CType for i32

Source§

fn reify() -> Type<Self>

Source§

impl CType for i64

Source§

fn reify() -> Type<Self>

Source§

impl CType for isize

Source§

fn reify() -> Type<Self>

Source§

impl CType for u8

Source§

fn reify() -> Type<Self>

Source§

impl CType for u16

Source§

fn reify() -> Type<Self>

Source§

impl CType for u32

Source§

fn reify() -> Type<Self>

Source§

impl CType for u64

Source§

fn reify() -> Type<Self>

Source§

impl CType for ()

Source§

fn reify() -> Type<Self>

Source§

impl CType for usize

Source§

fn reify() -> Type<Self>

Source§

impl<T> CType for *const T

Source§

fn reify() -> Type<Self>

Source§

impl<T> CType for *mut T

Source§

fn reify() -> Type<Self>

Implementors§