How to use SyncConnectionWrapper
from an existing sync connection (PooledConnection) #221
-
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 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
This is expected as Additionally this only supports the plain |
Beta Was this translation helpful? Give feedback.
This is expected as
SyncConnectionWrapper
expects to take ownership of the connection. If you provide only a mutable reference that's not possible.Additionally this only supports the plain
SqliteConnection
type for now. For any other connection type additional trait implementations in diesel are required.