Skip to content
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

Add Async Support #276

Merged
merged 90 commits into from
Oct 28, 2024
Merged

Add Async Support #276

merged 90 commits into from
Oct 28, 2024

Conversation

Electron100
Copy link
Owner

Add async support. There are still a few outstanding gaps and potential issues which are tracked in async_checklist.md. We'll wait to release 0.8 for those to be resolved.

Addresses #13

aDogCalledSpot and others added 30 commits December 25, 2022 13:42
The previous comment here indicated we saved the handle to keep the
task alive, but the docs for `JoinHandle` specifically say that a drop
detaches the handle from the task. It does not kill the task.
Just ConnectionMethods trait for now. More to come.
Sqlite compilation re-enabled but sqlite not enabled in tests yet

Still need to:
- A bunch of TODOs
- Sqlite tests
- Sync tests
- remove ?Send bound from async-trait. This may be tricky, but I
  believe it's required for the tokio rt executor.
- Clean up sync naming
- Clippy lints
@jayvdb
Copy link
Collaborator

jayvdb commented Oct 27, 2024

New Rust 1.82 lint rust-lang/rust#129207
It is allow by default - our CI is causing it to be an error when running rustdoc.

error: elided lifetime has a name
Error:    --> butane_core/src/db/dummy.rs:123:59
    |
123 |     async fn transaction(&mut self) -> Result<Transaction<'_>> {
    |                          -                                ^^ this elided lifetime gets resolved as `'life0`
    |                          |
    |                          lifetime `'life0` declared here
    |
    = note: `-D elided-named-lifetimes` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(elided_named_lifetimes)]`

error: elided lifetime has a name
Error:    --> butane_core/src/db/pg.rs:113:59
    |
113 |     async fn transaction(&mut self) -> Result<Transaction<'_>> {
    |                          -                                ^^ this elided lifetime gets resolved as `'life0`
    |                          |
    |                          lifetime `'life0` declared here

error: elided lifetime has a name
Error:   --> butane_core/src/db/mod.rs:94:59
   |
94 |     async fn transaction(&mut self) -> Result<Transaction<'_>>;
   |                          -                                ^^ this elided lifetime gets resolved as `'life0`
   |                          |
   |                          lifetime `'life0` declared here

error: elided lifetime has a name
Error:    --> butane_core/src/db/mod.rs:116:47
    |
116 |     async fn transaction(&mut self) -> Result<Transaction> {
    |                          -                    ^^^^^^^^^^^ this elided lifetime gets resolved as `'life0`
    |                          |
    |                          lifetime `'life0` declared here

error: elided lifetime has a name
Error:    --> butane_core/src/db/mod.rs:289:47
    |
289 |     async fn transaction(&mut self) -> Result<Transaction> {
    |                          -                    ^^^^^^^^^^^ this elided lifetime gets resolved as `'life0`
    |                          |
    |                          lifetime `'life0` declared here

error: elided lifetime has a name
Error:    --> butane_core/src/fkey.rs:100:74
    |
100 |     async fn load<'a>(&'a self, conn: &impl ConnectionMethods) -> Result<&T>
    |                   -- lifetime `'a` declared here                         ^ this elided lifetime gets resolved as `'a`

error: elided lifetime has a name
Error:    --> butane_core/src/fkey.rs:106:79
    |
106 |     async fn load<'a>(&'a self, conn: &impl ConnectionMethodsAsync) -> Result<&T>
    |                   -- lifetime `'a` declared here                              ^ this elided lifetime gets resolved as `'a`

error: elided lifetime has a name
Error:    --> butane_core/src/fkey.rs:123:68
    |
123 |     fn load<'a>(&'a self, conn: &impl ConnectionMethods) -> Result<&T>
    |             -- lifetime `'a` declared here                         ^ this elided lifetime gets resolved as `'a`
IMO we should ignore this warning in the rustdoc step if it cant be easily fixed.

butane_core/src/db/mod.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@jayvdb jayvdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two previous comments; but lgtm

@Electron100 Electron100 merged commit 3d71616 into master Oct 28, 2024
3 of 4 checks passed
@Electron100 Electron100 deleted the async-wip branch October 28, 2024 01:16
@jayvdb jayvdb mentioned this pull request Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants