-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return impl Future + Send + ‘lifetime
in traits instead of using async_trait
macro
#220
Comments
This is only stabilized in 1.75 (rust-lang/rust#115822), would this be considered a breaking change? |
Because of rust-lang/rust#100013, a breaking release might be needed |
Removing |
When the issue is fixed, this will simply allow the future to be |
The two traits that are affected by this are:
|
|
A breaking release seems not necessary at all now. The issue is (sort of) resolved in a weird way. Essentially, return position impl trait is used in trait declaration but async fn in trait is used in the trait implementation. ie. pub trait AsyncTrait {
fn some_async_fn() -> impl Future<Output = ()> + Send;
}
struct Foo;
impl AsyncTrait for Foo {
async fn some_async_fn() -> () {
// ....
}
} |
Implemented 0.9.4 and 0.8.27 |
Other crates have observed performance improvement after adopting this strategy (eg.
async-graphql
reports almost 20% performance gain).The text was updated successfully, but these errors were encountered: