How to use SyncConnectionWrapper from an existing sync connection (PooledConnection)
#221
Answered
by
weiznich
vincent-herlemont
asked this question in
Q&A
|
I have an insert function that takes async fn insert(
connection: &mut PooledConnection<ConnectionManager<diesel::SqliteConnection>>,
) -> Result<Vec<Self>, Error> {
use diesel_async::AsyncConnection;
use diesel_async::sync_connection_wrapper::SyncConnectionWrapper;
let connection = SyncConnectionWrapper::<Connection>::new(connection.into());
...
}It does not work because |
Answered by
weiznich
Mar 14, 2025
Replies: 1 comment 2 replies
|
This is expected as Additionally this only supports the plain |
2 replies
Answer selected by
vincent-herlemont
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is expected as
SyncConnectionWrapperexpects to take ownership of the connection. If you provide only a mutable reference that's not possible.Additionally this only supports the plain
SqliteConnectiontype for now. For any other connection type additional trait implementations in diesel are required.