[][src]Struct tokio_compat::runtime::current_thread::TaskExecutor

pub struct TaskExecutor { /* fields omitted */ }
This is supported on (feature="rt-current-thread" or feature="rt-full") and feature="rt-current-thread" only.

Executes futures on the current thread.

All futures executed using this executor will be executed on the current thread. As such, run will wait for these futures to complete before returning, if they are spawned without a JoinHandle.

For more details, see the module level documentation.

Methods

impl TaskExecutor[src]

pub fn current() -> TaskExecutor[src]

This is supported on feature="rt-current-thread" or feature="rt-full" only.

Returns an executor that executes futures on the current thread.

The user of TaskExecutor must ensure that when a future is submitted, that it is done within the context of a call to run.

For more details, see the module level documentation.

pub fn spawn_local(
    &mut self,
    future: impl Future01<Item = (), Error = ()> + 'static
) -> Result<(), SpawnError>
[src]

This is supported on feature="rt-current-thread" or feature="rt-full" only.

Spawn a futures 0.1 future onto the current CurrentThread instance.

pub fn spawn_local_std(
    &mut self,
    future: impl Future<Output = ()> + 'static
) -> Result<(), SpawnError>
[src]

This is supported on feature="rt-current-thread" or feature="rt-full" only.

Spawn a std::futures future onto the current CurrentThread instance.

pub fn spawn_handle<T: 'static, E: 'static>(
    &mut self,
    future: impl Future01<Item = T, Error = E> + 'static
) -> JoinHandle<Result<T, E>>
[src]

This is supported on feature="rt-current-thread" or feature="rt-full" only.

Spawn a futures 0.1 future onto the current CurrentThread instance, returning a JoinHandle that can be used to await its result.

Note that futures spawned in this manner do not "count" towards keeping the runtime active for shutdown_on_idle, since they are paired with a JoinHandle for awaiting their completion. See here for details on shutting down the compatibility runtime.

Panics

This function panics if there is no current runtime, or if the current runtime is not a current-thread runtime.

pub fn spawn_handle_std<T: 'static>(
    &mut self,
    future: impl Future<Output = T> + 'static
) -> JoinHandle<T>
[src]

This is supported on feature="rt-current-thread" or feature="rt-full" only.

Spawn a std::future future onto the current CurrentThread instance, returning a JoinHandle that can be used to await its result.

Note that futures spawned in this manner do not "count" towards keeping the runtime active for shutdown_on_idle, since they are paired with a JoinHandle for awaiting their completion. See here for details on shutting down the compatibility runtime.

Panics

This function panics if there is no current runtime, or if the current runtime is not a current-thread runtime.

Trait Implementations

impl Debug for TaskExecutor[src]

impl<T> Executor<T> for TaskExecutor where
    T: Future01<Item = (), Error = ()> + 'static, 
[src]

impl Executor for TaskExecutor[src]

impl<F> TypedExecutor<F> for TaskExecutor where
    F: Future01<Item = (), Error = ()> + 'static, 
[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.