You've already forked wit-bindgen
mirror of
https://github.com/AdaCore/wit-bindgen.git
synced 2026-02-12 13:12:42 -08:00
* provide more control over type ownership This is the guest version of https://github.com/bytecodealliance/wasmtime/pull/6648. This replaces the duplicate_if_necessary parameter to the Rust binding generator with a new ownership parameter which provides finer-grained control over whether and how generated types own their fields. The default is `Ownership::Owning`, which means types own their fields regardless of how they are used in functions. These types are passed by reference when used as parameters to guest-exported functions. Note that this also affects how unnamed types (e.g. `list<list<string>>`) are passed: using a reference only at the top level (e.g. `&[Vec<String>]` instead of `&[&[&str]]`, which is more difficult to construct when using non-'static data). The other option is `Ownership::Borrowing`, which includes a `duplicate_if_necessary` field, providing the same code generation strategy as was used prior to this change. Signed-off-by: Joel Dice <joel.dice@fermyon.com> * fix tests Signed-off-by: Joel Dice <joel.dice@fermyon.com> * fix tests, part 2 Signed-off-by: Joel Dice <joel.dice@fermyon.com> --------- Signed-off-by: Joel Dice <joel.dice@fermyon.com>