[][src]Function uniffi_build::generate_scaffolding

pub fn generate_scaffolding(idl_file: &str) -> Result<()>

Generate the rust "scaffolding" required to build a uniffi component.

Given the path to an IDL file, this function will call the uniffi-bindgen command-line tool to generate the pub extern "C" functions and other supporting code required to expose the defined interface from Rust. The expectation is that this will be called from a crate's build script, and the resulting file will be include!()ed into the build.

Given an IDL file named example.idl, the generated scaffolding will be written into a file named example.uniffi.rs in the $OUT_DIR directory.

If the "builtin-bindgen" feature is enabled then this will take a dependency on the uniffi_bindgen crate and call its methods directly, rather than using the command-line tool. This is mostly useful for developers who are working on uniffi itself and need to test out their changes to the bindings generator.