Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rust API (cargo doc)

The weaveffi producer crate

A Rust producer depends on a single crate, weaveffi. It re-exports the #[weaveffi::module] family of attributes and the export_runtime! macro, plus the C ABI runtime as weaveffi::abi. Annotate a normal module, tag the items to export, and the macro emits the #[no_mangle] extern "C" thunks for you. See The Rust Producer Macro for the full guide.

[dependencies]
weaveffi = "0.12"

The supporting crates are published separately and are useful when you need the lower layers directly:

CrateWhat it is
weaveffiThe producer facade: the attribute macros, export_runtime!, and abi. Depend on this.
weaveffi-abiThe stable C ABI runtime: weaveffi_error, memory helpers, cancel tokens, the arena, and the lift_*/lower_* marshalling converters the macro calls. The macro generates code against it; a producer reaches the same helpers through weaveffi::abi when it needs one directly (for example to dereference a raw handle).
weaveffi-macrosThe proc-macro implementation behind weaveffi’s attributes. You rarely depend on it directly.
weaveffi-irThe IR types (Api, Module, TypeRef, …) and the IDL parser.

Browsing the docs

Generate and view the Rust API docs locally:

cargo doc --workspace --all-features --no-deps --open

When the documentation site is deployed, API docs are available at weavefoundry.github.io/weaveffi/api/rust/weaveffi_core/.