Function uniffi_build::generate_scaffolding
source · pub fn generate_scaffolding(udl_file: impl AsRef<Utf8Path>) -> Result<()>
Expand description
Generate the rust “scaffolding” required to build a uniffi component.
Given the path to an UDL 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.
This function will attempt to locate and parse a corresponding Cargo.toml to determine the crate name which will host this UDL.
Given an UDL file named example.udl
, the generated scaffolding will be written
into a file named example.uniffi.rs
in the $OUT_DIR
directory.