Struct agnostic_async_executor::AgnosticExecutor[][src]

pub struct AgnosticExecutor { /* fields omitted */ }

An executor that can spawn futures. This can be freely stored anywhere you need, cloned, and be sent to other threads.

Implementations

impl AgnosticExecutor[src]

pub fn spawn<F, T>(&self, future: F) -> JoinHandle<T>

Notable traits for JoinHandle<T>

impl<T: 'static> Future for JoinHandle<T> type Output = T;
where
    F: Future<Output = T> + Send + 'static,
    T: Send + 'static, 
[src]

Spawns a future on this executor.

pub fn spawn_blocking<F, T>(&self, task: F) -> JoinHandle<T>

Notable traits for JoinHandle<T>

impl<T: 'static> Future for JoinHandle<T> type Output = T;
where
    F: FnOnce() -> T + Send + 'static,
    T: Send + 'static, 
[src]

Runs the provided closure, and when possible, it does it in a way that doesn't block concurrent tasks.

impl AgnosticExecutor[src]

pub async fn sleep(&self, duration: Duration)[src]

Returns a future that sleeps for a duration.

pub async fn sleep_millis(&self, duration: u64)[src]

Returns a future that sleeps for a duration in milliseconds.

pub async fn timeout<T: Future>(
    &self,
    duration: Duration,
    future: T
) -> Result<T::Output, TimedOut>
[src]

Wraps a future in a timeout that expires after a duration if the provided future didn't finish.

pub async fn timeout_millis<T: Future>(
    &self,
    duration: u64,
    future: T
) -> Result<T::Output, TimedOut>
[src]

Wraps a future in a timeout that expires after a duration in milliseconds if the provided future didn't finish.

pub fn interval(&self, duration: Duration) -> Interval[src]

Creates a new Interval for a given duration.

pub fn interval_millis(&self, duration: u64) -> Interval[src]

Creates a new Interval for a given duration in milliseconds.

Trait Implementations

impl Clone for AgnosticExecutor[src]

impl Debug for AgnosticExecutor[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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.