Skip to main content

Module sync

Module sync 

Source
Expand description

Synchronous wrapper that turns an async backend driver into the public blocking Connection API.

ferrule-sql‘s drivers (tokio-postgres, mysql_async, tiberius) are async. Rather than expose that async surface to embedders — many of which run no runtime of their own — every connection handle owns one private current-thread tokio runtime and drives each driver future to completion with block_on. The runtime is created once at connect time and lives inside SyncConnection for the connection’s lifetime, so the same runtime that spawned a driver’s background I/O task (e.g. tokio-postgres’ connection task) also polls it on every subsequent call. No async fn / Future crosses the public boundary.

Structs§

SyncConnection
A blocking Connection backed by an async driver and a private current-thread runtime.