Stream: general

Topic: wit-bindgen: Use of borrow<T>?


view this post on Zulip Bogdan Arabadzhi (May 19 2025 at 07:55):

I've tried to pass in borrowed data as a param , or return it from Rust impl that is using wit-bindgen, but it choked on generate every time. :thinking:

What is the general support of borrow in wit-bindgen?
How to use it (if at all supported)?

view this post on Zulip Alex Crichton (May 19 2025 at 12:23):

There should be full support of borrow<T> in all rust bindings generators (e.g. wasmtime and wit-bindgen), but note that you cannot return a borrow<T> from a function. That's a requirement of the component model that it's not possible. I forget if WIT tooling reflects this in processing/bindings generation


Last updated: Dec 06 2025 at 05:03 UTC