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 Freeze for InventoryBuilder
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