Comments (4)
This is essentially a duplicate of #23
As explained there this is a limitation of the current implementation of async
in rustc, which means we cannot do much to improve the situation there as long as there are not substantial improvements on the language/compiler side. As for the error message: Yes that one is not great, but again: It's something that comes from rustc, so please report this in their repository. They care for such bad error messages and that's a quite general case here.
As a workaround: Your callback needs to own all relevant values. Use something like
let user: User = conn
.transaction(move |conn| Box::pin(async move { users::table.find(user_id).first(conn).await }))
.await?;
Closed as this is not actionable from our side.
from diesel_async.
Thanks. I did not think to check the GH discussions, only the issues, sorry.
Sadly the workaround is ... not that possible as I'm handed borrowed data directly. I'd need to clone it, which is not ideal at all. Oh well, that's what I'm getting for being on the bleeding edge 😄
from diesel_async.
I'd need to clone it, which is not ideal at all.
I fear cloning stuff is currently the only possible solution. I'm happy to be proven wrong here, but I just do not see any other option to write such an API at all.
from diesel_async.
Yep, in this case I cannot avoid cloning as I'm passed references. In the owned case, the usual lifetime joker that is Arc is a solution though.
from diesel_async.
Related Issues (20)
- 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
- r2d2 not supported with AsyncPgConnection HOT 2
- Unable to connect to PostgreSQL in a separate Kubernetes pod using Diesel in Rust
- Failed to save array of enums HOT 2
- 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
- Release with Diesel 2.2.1 HOT 2
- Confirmation on production readiness of diesel-async currently?
- the trait bound `model::TimerangeItem: FromSqlRow<Untyped, Pg>` is not satisfied
- Unable to inject async DB connection via web::Dta<Pool<<>>>>
- Unable to specify the type for sqlite pool HOT 7
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.