Trait AsRawFFI

Source
pub(crate) trait AsRawFFI {
    type FFI;

    // Required method
    unsafe fn raw_ffi(&self) -> Self::FFI;
}
Expand description

Trait for types that can provide a raw FFI representation.

This trait is used to convert Rust types into their corresponding C FFI types for passing across the FFI boundary.

§Safety

Users must ensure that the returned FFI value is never used past the duration of the original value’s lifetime

Required Associated Types§

Source

type FFI

The corresponding C FFI type.

Required Methods§

Source

unsafe fn raw_ffi(&self) -> Self::FFI

Converts this value to its raw FFI representation.

§Safety

Users must ensure that the returned FFI value is never used past the duration of the original value’s lifetime

Implementations on Foreign Types§

Source§

impl AsRawFFI for str

Source§

type FFI = ConstStr

Source§

unsafe fn raw_ffi(&self) -> Self::FFI

Source§

impl AsRawFFI for String

Source§

type FFI = ConstStr

Source§

unsafe fn raw_ffi(&self) -> Self::FFI

Source§

impl<S: AsRawFFI + ?Sized> AsRawFFI for &S

Source§

type FFI = <S as AsRawFFI>::FFI

Source§

unsafe fn raw_ffi(&self) -> Self::FFI

Source§

impl<S: AsRawFFI<FFI = ConstStr>> AsRawFFI for Option<S>

Source§

type FFI = ConstStr

Source§

unsafe fn raw_ffi(&self) -> Self::FFI

Source§

impl<const N: usize> AsRawFFI for Buffer<N, false>

Source§

type FFI = ConstStr

Source§

unsafe fn raw_ffi(&self) -> Self::FFI

Implementors§