Comments (2)
Essentially a duplicate of #113
from diesel_async.
I suppose this is because r2d2 isn't really designed for async connections. You can see an attempt here: b9fd59c.
But you end up hitting this error:
$ cargo build --features r2d2
Compiling diesel-async v0.4.1 (/Users/dport/github/diesel_async)
error[E0728]: `await` is only allowed inside `async` functions and blocks
--> src/pooled_connection/r2d2.rs:67:14
|
65 | / fn connect(&self) -> Result<Self::Connection, Self::Error> {
66 | | (self.manager_config.custom_setup)(&self.connection_url)
67 | | .await
| | ^^^^^ only allowed inside `async` functions and blocks
68 | | .map_err(PoolError::ConnectionError)
69 | | }
| |_____- this is not `async`
error[E0728]: `await` is only allowed inside `async` functions and blocks
--> src/pooled_connection/r2d2.rs:73:14
|
71 | / fn is_valid(&self, conn: &mut Self::Connection) -> Result<(), Self::Error> {
72 | | conn.ping(&self.manager_config.recycling_method)
73 | | .await
| | ^^^^^ only allowed inside `async` functions and blocks
74 | | .map_err(PoolError::QueryError)
75 | | }
| |_____- this is not `async`
For more information about this error, try `rustc --explain E0728`.
error: could not compile `diesel-async` (lib) due to 2 previous errors
Either you'd have to make non async implementations of these functions inside AsyncDieselConnectionManager (in which case it's not really async) or use tokio::block_on internally.
from diesel_async.
Related Issues (20)
- Failed to find a type oid for ENUM_TYPE HOT 30
- Compiler requires `'static` when using transactions on generic AsyncConnection HOT 1
- The trait MultiConnection is not implemented
- conflicting implementations of trait `diesel_async::RunQueryDsl<_>` for type `paginate_async::PaginatedQuery<_, _>` HOT 4
- conflicting implementations of trait diesel_async::RunQueryDsl<_> for type paginate_async::PaginatedQuery<_, _> HOT 1
- use diesel_async::RunQueryDsl::execute conflicts with meilisearch_sdk execute HOT 5
- AsyncConnectionWrapper does not implement `build_transaction` HOT 2
- Unable to connect to PostgreSQL in a separate Kubernetes pod using Diesel in Rust
- Failed to save array of enums HOT 1
- Is there some way to get the last insert id after an insert operation?
- Problem trait LoadQuery is not satisfied sub query when implement Pagination
- New release? HOT 1
- Incoherence between Diesel and Diesel_async on MySQL/MariaDB connection (UPDATE return value) HOT 1
- The conneciton pool returns corrupt connections HOT 3
- RunQueryDsl overrides calls to vec.first() to RunQueryDsl::first() HOT 4
- 0.4.x doesn't work with custom types HOT 1
- diesel_async does not support sql_query (async) HOT 3
- Unable to execute `COPY FROM`, likely due to missing `ExecuteCopyFromDsl` trait HOT 1
- Fail to get the connection with the features ["postgres", "bb8"] HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diesel_async.