Struct tokio_io_pool::Handle
source · pub struct Handle { /* private fields */ }
Expand description
A handle to a Runtime
that allows spawning additional futures from other threads.
Implementations§
source§impl Handle
impl Handle
sourcepub fn spawn<F>(&self, future: F) -> Result<&Self, SpawnError>where
F: Future<Item = (), Error = ()> + Send + 'static,
pub fn spawn<F>(&self, future: F) -> Result<&Self, SpawnError>where
F: Future<Item = (), Error = ()> + Send + 'static,
Spawn a future onto a runtime in the pool.
This spawns the given future onto a single thread runtime’s executor. That thread is then responsible for polling the future until it completes.
sourcepub fn spawn_all<S>(
&self,
stream: S
) -> impl Future<Item = (), Error = StreamSpawnError<<S as Stream>::Error>>where
S: Stream,
<S as Stream>::Item: Future<Item = (), Error = ()> + Send + 'static,
pub fn spawn_all<S>(
&self,
stream: S
) -> impl Future<Item = (), Error = StreamSpawnError<<S as Stream>::Error>>where
S: Stream,
<S as Stream>::Item: Future<Item = (), Error = ()> + Send + 'static,
Spawn all futures yielded by a stream onto the pool.
This produces a future that accepts futures from a Stream
and spawns them all onto the
pool round-robin.