[][src]Module dbcrossbarlib::tokio_glue

Glue code for working with tokio's async I/O.

This is mostly smaller things that happen to recur in our particular application.

Traits

ConsumeWithParallelism

Extension for BoxStream<BoxFuture<()>>.

Functions

run_futures_with_runtime

Create a new tokio runtime and use it to run cmd_future (which carries out whatever task we want to perform), and worker_future (which should have been created by Context::create or Context::create_for_test).

spawn_blocking

Run a synchronous function f in a background worker thread and return its value.

try_forward

Copy stream into sink. If stream returns an Err value, stop immediately.

Type Definitions

BoxFuture

Standard future type for this library. Like Result, but used by async. We mark it as Send to ensure it can be sent between threads safely (even when blocked on .await!), and we Pin<Box<...>> it using .boxed() to make it an abstract, heap-based type, for convenience. All we know is that it will return a Result<T>.

BoxStream

A stream of values of type T, using our standard error type, and imposing enough restrictions to be able send streams between threads.