Feature
Remove the use of async_trait in bindgen! as per #9776 (comment). Use async fn in traits, RPITIT and trait_variant instead.
Benefit
Removing async_trait simplifies the generated code by bindgen! a lot. This can also drastically improve IDE experience as IDEs have better support for async fn in traits and RPITIT. Coding experience should be much better as well, as programmers can just use async fn when implementing autogenerated traits by bindgen in async mode.
Implementation
Note: I don't have time to dig into details now, so this issue is primary for tracking. Probably someone can tag this as "good first issue" :)
Just search for ::async_trait in the source code of wit-bindgen crate:
https://github.com/search?q=repo%3Abytecodealliance%2Fwasmtime+path%3A%2F%5Ecrates%5C%2Fwit-bindgen%5C%2F%2F+%3A%3Aasync_trait&type=code
There are not many occurrences to my surprise.
In theory, we need to generate something like:
#[trait_variant::make(HostX: Send)]
pub trait LocalHostX {
//...
}
instead of
#[async_trait]
pub trait HostX {
//...
}
cc @alexcrichton
Feature
Remove the use of
async_traitinbindgen!as per #9776 (comment). Use async fn in traits, RPITIT andtrait_variantinstead.Benefit
Removing
async_traitsimplifies the generated code bybindgen!a lot. This can also drastically improve IDE experience as IDEs have better support for async fn in traits and RPITIT. Coding experience should be much better as well, as programmers can just useasync fnwhen implementing autogenerated traits bybindgenin async mode.Implementation
Note: I don't have time to dig into details now, so this issue is primary for tracking. Probably someone can tag this as "good first issue" :)
Just search for
::async_traitin the source code ofwit-bindgencrate:https://github.com/search?q=repo%3Abytecodealliance%2Fwasmtime+path%3A%2F%5Ecrates%5C%2Fwit-bindgen%5C%2F%2F+%3A%3Aasync_trait&type=code
There are not many occurrences to my surprise.
In theory, we need to generate something like:
instead of
cc @alexcrichton