Hi, I don't see much examples of resource with rust.
I get a complex rust struct which is used as func arg.
Instead of rewriting / adapting this struct into wit file, I use a resource instead.
But how to convert the resource as original struct? I need to use the original struct to call a fn
fn myfn(myresource: my-resource) {
mycrate::func(myoriginalstruct_from resource) ;
}
this is an example of the bindings for exported resources, and you'd call the methods there with the right T that you're using
Another resource is the section in the Component Model Book about resources in Rust:
https://component-model.bytecodealliance.org/language-support/using-wit-resources/rust.html
(If you find something wrong/unintuitive, please let us know and we'll update the docs there)
Thanks for the 2 links but I still don't know what I have to do.
I guess I have to do a From but not sure
Last updated: May 03 2026 at 22:13 UTC