Trait rdkafka::util::AsyncRuntime
source · [−]pub trait AsyncRuntime: Send + Sync + 'static {
type Delay: Future<Output = ()> + Send;
fn spawn<T>(task: T)
where
T: Future<Output = ()> + Send + 'static;
fn delay_for(duration: Duration) -> Self::Delay;
}
Expand description
An abstraction over asynchronous runtimes.
There are several asynchronous runtimes available for Rust. By default
rust-rdkafka uses Tokio, via the TokioRuntime
, but it has pluggable
support for any runtime that can satisfy this trait.
For an example of using the smol runtime with rust-rdkafka, see the runtime_smol example.
For an example of using the async-std runtime with rust-rdkafka, see the runtime_async_std example.
Required Associated Types
Required Methods
Implementors
sourceimpl AsyncRuntime for NaiveRuntime
Available on crate feature naive-runtime
only.
impl AsyncRuntime for NaiveRuntime
Available on crate feature
naive-runtime
only.sourceimpl AsyncRuntime for TokioRuntime
Available on crate feature tokio
only.
impl AsyncRuntime for TokioRuntime
Available on crate feature
tokio
only.