Function uniffi_bindgen::generate_external_bindings
source · pub fn generate_external_bindings<T: BindingGenerator>(
binding_generator: &T,
udl_file: impl AsRef<Utf8Path>,
config_file_override: Option<impl AsRef<Utf8Path>>,
out_dir_override: Option<impl AsRef<Utf8Path>>,
library_file: Option<impl AsRef<Utf8Path>>,
crate_name: Option<&str>,
try_format_code: bool
) -> Result<()>Expand description
Generate bindings for an external binding generator
Ideally, this should replace the generate_bindings function below
Implements an entry point for external binding generators. The function does the following:
- It parses the
udlin aComponentInterface - Parses the
uniffi.tomland loads it into the type that implementsBindingsConfig - Creates an instance of
BindingGenerator, based on type argumentB, and runBindingGenerator::write_bindingson it
Arguments
binding_generator: Type that implements BindingGeneratorudl_file: The path to the UDL fileconfig_file_override: The path to the configuration toml file, most likely calleduniffi.toml. IfNone, the function will try to guess based on the crate’s root.out_dir_override: The path to write the bindings to. IfNone, it will be the path to the parent directory of theudl_filelibrary_file: The path to a dynamic library to attempt to extract the definitions from and extend the component interface with. No extensions to component interface occur if it’sNonecrate_name: Override the default crate name that is guessed from UDL file path.