ffi::types
Each tag stands for one C type. Pass a tuple of tags for the arguments and one
tag for the return type to declare.
Built into the compiler.
Import what you use (use path::* is not allowed):
use ffi::types::{Int, Float};
Types#
| Name | Description |
|---|---|
Int | FFI tag for a 64-bit signed integer (int64_t), passed from and returned as int. |
Float | FFI tag for a 64-bit float (double), passed from and returned as float. |
String | FFI tag for a NUL-terminated C string (const char *), passed from and returned as string. |
Void | FFI tag for no value (void), valid only as a return type. |
Bool | FFI tag for a C bool (one byte, 0 or 1), passed from and returned as bool. |
Int8 | FFI tag for an 8-bit signed integer (int8_t), passed from and returned as int. |
Int16 | FFI tag for a 16-bit signed integer (int16_t), passed from and returned as int. |
Int32 | FFI tag for a 32-bit signed integer (int32_t), passed from and returned as int. |
UInt8 | FFI tag for an 8-bit unsigned integer (uint8_t), passed from and returned as int. |
UInt16 | FFI tag for a 16-bit unsigned integer (uint16_t), passed from and returned as int. |
UInt32 | FFI tag for a 32-bit unsigned integer (uint32_t), passed from and returned as int. |
UInt64 | FFI tag for a 64-bit unsigned integer (uint64_t), passed from and returned as int. |
Ptr | FFI tag for a raw pointer (void *), returned as an int address. |
Callback | FFI tag for a C function pointer, letting C call back into a Coil function. |
Struct | FFI tag for a C struct passed or returned by value. |
Bytes | FFI tag for a writable byte buffer (uint8_t *) made from a Vec<byte>. |
ConstBytes | FFI tag for a read-only byte view (const uint8_t *) of a string or Vec<byte>. |