Struct deno_libffi::middle::Type[][src]

pub struct Type(_);
Expand description

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 deno_libffi::middle::Type;

let my_struct = Type::structure(vec![
    Type::u64(),
    Type::u16(),
]);

Implementations

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.

Returns the unsigned 8-bit numeric type.

Returns the signed 8-bit numeric type.

Returns the unsigned 16-bit numeric type.

Returns the signed 16-bit numeric type.

Returns the unsigned 32-bit numeric type.

Returns the signed 32-bit numeric type.

Returns the unsigned 64-bit numeric type.

Returns the signed 64-bit numeric type.

Returns the C equivalent of Rust usize (u64).

Returns the C equivalent of Rust isize (i64).

Returns the C signed char type.

Returns the C unsigned char type.

Returns the C short type.

Returns the C unsigned short type.

Returns the C int type.

Returns the C unsigned int type.

Returns the C long type.

Returns the C unsigned long type.

Returns the C longlong type.

Returns the C unsigned longlong type.

Returns the C float (32-bit floating point) type.

Returns the C double (64-bit floating point) type.

Returns the C void* type, for passing any kind of pointer.

Returns the C long double (extended-precision floating point) type.

Constructs a structure type whose fields have the given types.

Gets a raw pointer to the underlying ffi_type.

This method may be useful for interacting with the low and raw layers.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.