Generating bindings
"Bindings" is the term for the non-Rust side of the environment - the generated Python, Swift or Kotlin code which drives the examples.
UniFFI comes with a uniffi_bindgen which generates these bindings. For introductory
information, see Foreign Language Bindings in the tutorial.
There are also external bindings which don't live in this repo.
You can configure what's generated by uniffi_bindgen, via the command line, a uniffi.toml in each crate, combined with a "global" config file. See the configuration docs for more.
Ultimately, you might be running a command like:
uniffi-bindgen generate --config global.toml -l swift -o out/ libmylibrary.dylib
Crate locations
UniFFI needs to locate UDL files and uniffi.toml files for each referenced crate.
It uses the same mechanism in both places - either via the cargo-metadata feature,
and/or via global configuration.
See the discussion about [crate-roots] in configuration docs for more.
If there's no [crate-roots] entry for a crate, we'll try and fall back to using cargo-metadata
if it's enabled, otherwise we'll use the default config for the crate (and give an error if we need a UDL).
Avoiding cargo-metadata might mean using a global.toml with contents like:
[crate-roots]
# These entries also tell UniFFI where to find `suggest.udl` or `uniffi.toml` files,
# avoiding cargo-metadata. Path is relative to the directory of this config file.
suggest = "./components/suggest"
tabs = "./components/tabs"
There's more on this in the configuration docs.