Trait Runtime

Source
pub trait Runtime {
    type Spawner: Spawner;

    // Required methods
    fn spawner(&self) -> Self::Spawner;
    fn exec<Fut>(&mut self, fut: Fut) -> Fut::Output
       where Fut: Future;
}
Expand description

The Runtime for driving the application.

Required Associated Types§

Source

type Spawner: Spawner

The value for spawning cases.

Required Methods§

Source

fn spawner(&self) -> Self::Spawner

Create the instance of Spawner.

Source

fn exec<Fut>(&mut self, fut: Fut) -> Fut::Output
where Fut: Future,

Run a future and wait for its result.

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.

Implementations on Foreign Types§

Source§

impl<T> Runtime for &mut T
where T: Runtime + ?Sized,

Source§

type Spawner = <T as Runtime>::Spawner

Source§

fn spawner(&self) -> Self::Spawner

Source§

fn exec<Fut>(&mut self, fut: Fut) -> Fut::Output
where Fut: Future,

Source§

impl<T> Runtime for Box<T>
where T: Runtime + ?Sized,

Source§

type Spawner = <T as Runtime>::Spawner

Source§

fn spawner(&self) -> Self::Spawner

Source§

fn exec<Fut>(&mut self, fut: Fut) -> Fut::Output
where Fut: Future,

Implementors§