Macro interoptopus::extra_type
source · macro_rules! extra_type { ($x:ty) => { ... }; }
Expand description
Register an extra type with an InventoryBuilder
.
You must also annotate the type with #[ffi_type]
and #[repr(C)]
.
Note, most types are registered automatically. You only need this to pass types not directly visible in your function signatures, e.g., when accepting multiple types via a void pointer.
§Example
use interoptopus::{ffi_type, Inventory, InventoryBuilder, extra_type};
#[ffi_type]
#[repr(C)]
pub struct S<T> {
t: T
};
pub fn inventory() -> Inventory {
InventoryBuilder::new()
.register(extra_type!(S<f32>))
.inventory()
}