Struct libffi::middle::Type
[−]
[src]
pub struct Type(_);
Represents a single C type.
Example
Suppose we have a C struct:
struct my_struct {
uint16_t f1;
uint64_t f2;
};
To pass the struct by value via libffi, we need to construct a
Type
object describing its layout:
use libffi::middle::Type; let my_struct = Type::structure(vec![ Type::u64(), Type::u16(), ]);
Methods
impl Type
[src]
pub fn void() -> Self
[src]
Returns the representation of the C void
type.
This is used only for the return type of a CIF, not for an argument or struct member.
pub fn u8() -> Self
[src]
Returns the unsigned 8-bit numeric type.
pub fn i8() -> Self
[src]
Returns the signed 8-bit numeric type.
pub fn u16() -> Self
[src]
Returns the unsigned 16-bit numeric type.
pub fn i16() -> Self
[src]
Returns the signed 16-bit numeric type.
pub fn u32() -> Self
[src]
Returns the unsigned 32-bit numeric type.
pub fn i32() -> Self
[src]
Returns the signed 32-bit numeric type.
pub fn u64() -> Self
[src]
Returns the unsigned 64-bit numeric type.
pub fn i64() -> Self
[src]
Returns the signed 64-bit numeric type.
pub fn usize() -> Self
[src]
Returns the C equivalent of Rust usize
(u64
).
pub fn isize() -> Self
[src]
Returns the C equivalent of Rust isize
(i64
).
pub fn c_schar() -> Self
[src]
Returns the C signed char
type.
pub fn c_uchar() -> Self
[src]
Returns the C unsigned char
type.
pub fn c_short() -> Self
[src]
Returns the C short
type.
pub fn c_ushort() -> Self
[src]
Returns the C unsigned short
type.
pub fn c_int() -> Self
[src]
Returns the C int
type.
pub fn c_uint() -> Self
[src]
Returns the C unsigned int
type.
pub fn c_long() -> Self
[src]
Returns the C long
type.
pub fn c_ulong() -> Self
[src]
Returns the C unsigned long
type.
pub fn c_longlong() -> Self
[src]
Returns the C longlong
type.
pub fn c_ulonglong() -> Self
[src]
Returns the C unsigned longlong
type.
pub fn f32() -> Self
[src]
Returns the C float
(32-bit floating point) type.
pub fn f64() -> Self
[src]
Returns the C double
(64-bit floating point) type.
pub fn pointer() -> Self
[src]
Returns the C void*
type, for passing any kind of pointer.
pub fn longdouble() -> Self
[src]
Returns the C long double
(extended-precision floating point) type.
pub fn structure<I>(fields: I) -> Self where
I: IntoIterator<Item = Type>,
I::IntoIter: ExactSizeIterator<Item = Type>,
[src]
I: IntoIterator<Item = Type>,
I::IntoIter: ExactSizeIterator<Item = Type>,
Constructs a structure type whose fields have the given types.
pub fn as_raw_ptr(&self) -> *mut ffi_type
[src]
Trait Implementations
impl Debug for Type
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more