Struct interoptopus::InventoryBuilder
source ยท pub struct InventoryBuilder { /* private fields */ }
Expand description
Produces a Inventory
inside your inventory function, start here.
ยงExample
Define an inventory function containing a function, constant, and an extra type.
This function can be called from your unit tests and the returned Inventory
used to create bindings.
use interoptopus::{Inventory, InventoryBuilder, function, constant, extra_type, pattern, ffi_function, ffi_constant, ffi_type};
// First, define some items our DLL uses or needs.
#[ffi_function]
#[no_mangle]
pub extern "C" fn primitive_void() { }
#[ffi_constant]
pub const MY_CONSTANT: u32 = 123;
#[ffi_type]
#[repr(C)]
pub struct ExtraType<T> {
x: T
}
// Then list all items for which to generate bindings. Call this function
// from another crate or unit test and feed the `Library` into a backend to
// generate bindings for a specific language.
pub fn my_inventory() -> Inventory {
InventoryBuilder::new()
.register(function!(primitive_void))
.register(constant!(MY_CONSTANT))
.register(extra_type!(ExtraType<f32>))
.inventory()
}
Implementationsยง
Trait Implementationsยง
sourceยงimpl Debug for InventoryBuilder
impl Debug for InventoryBuilder
sourceยงimpl Default for InventoryBuilder
impl Default for InventoryBuilder
sourceยงfn default() -> InventoryBuilder
fn default() -> InventoryBuilder
Returns the โdefault valueโ for a type. Read more
Auto Trait Implementationsยง
impl RefUnwindSafe for InventoryBuilder
impl Send for InventoryBuilder
impl Sync for InventoryBuilder
impl Unpin for InventoryBuilder
impl UnwindSafe for InventoryBuilder
Blanket Implementationsยง
sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more