pub fn create_async_runtime() -> Result<Runtime, CreateRuntimeError>
Expand description
Create a Tokio async runtime
Use this runtime to run async code in block
mode. Run blocked code is
required by Postgres callback functions which is fine because Postgres
process is single-threaded.
For example,
let rt = create_async_runtime()?;
// client.query() is an async function returning a Result
match rt.block_on(client.query(&sql)) {
Ok(result) => { }
Err(err) => { }
}