AsyncRuntime

Trait AsyncRuntime 

Source
pub trait AsyncRuntime {
    // Required method
    async fn yield_now(&self);
}
Expand description

Async runtime abstraction

Abstracts async runtime like tokio. Currently only exposes a yield_now function.

Required Methods§

Source

async fn yield_now(&self)

Yields the execution back to the runtime

If the protocol performs a long computation, it might be better for performance to split it with yield points, so the single computation does not starve other tasks.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl AsyncRuntime for TokioRuntime

Available on crate feature runtime-tokio only.
Source§

impl AsyncRuntime for UnknownRuntime

Source§

impl<M> AsyncRuntime for Runtime<M>

Available on crate feature state-machine only.