-
-
Notifications
You must be signed in to change notification settings - Fork 130
Replace async_trait with native async fns #230
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
Conversation
|
@djc we have an issue with the coverage pipeline: |
djc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mostly looks good to me. Please squash into two commits:
- MSRV bump
- All the code changes
bb8/src/api.rs
Outdated
| /// error, it will be forwarded to the configured error sink. | ||
| async fn on_acquire(&self, _connection: &mut C) -> Result<(), E> { | ||
| Ok(()) | ||
| fn on_acquire<'a, 'b, 'r>(&'a self, _connection: &'b mut C) -> BoxFuture<'r, Result<(), E>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we spell this <'r, 'a: 'r, 'b: 'r> instead? And do we really need the 3 separate lifetimes?
Why is BoxFuture useful? Could we just do Box<dyn Future<..>> instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BoxFuture<'a, T> is actually Pin<Box<dyn Future<Output = T> + Send + 'a>>. I'll apply the suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And do we really need the 3 separate lifetimes?
I'm not sure, but that's what async_trait generated, so I kept it to prevent further breaking changes in the API.
|
I think #231 has solved the coverage issue, please rebase on top of current main. |
e88d79c to
7343297
Compare
|
@djc I applied the following suggested changes:
Let me know if you have any further suggestions. |
7343297 to
148d27a
Compare
|
Please also add a separate commit that bumps all the version numbers. |
148d27a to
dce257b
Compare
dce257b to
8c104dd
Compare
|
@djc done. |
|
Thanks! |
|
Note that the usage of
CustomizeConnectionrequires it to be object safe, and thus we need to use boxed futures instead of plain async fns.