[][src]Struct bounded_executor::BoundedExecutor

pub struct BoundedExecutor { /* fields omitted */ }

Implementations

impl BoundedExecutor[src]

pub fn new(capacity: usize, executor: Handle) -> Self[src]

Create a new BoundedExecutor from an existing tokio Handle with a maximum concurrent task capacity of capacity.

pub async fn spawn<F, '_>(&'_ self, f: F) -> JoinHandle<F::Output> where
    F: Future + Send + 'static,
    F::Output: Send + 'static, 
[src]

Spawn a Future on the BoundedExecutor. This function is async and will block if the executor is at capacity until one of the other spawned futures completes. This function returns a JoinHandle that the caller can .await on for the results of the Future.

pub fn try_spawn<F>(&self, f: F) -> Result<JoinHandle<F::Output>, F> where
    F: Future + Send + 'static,
    F::Output: Send + 'static, 
[src]

Try to spawn a Future on the BoundedExecutor. If the BoundedExecutor is at capacity, this will return an Err(F), passing back the future the caller attempted to spawn. Otherwise, this will spawn the future on the executor and send back a JoinHandle that the caller can .await on for the results of the Future.

Trait Implementations

impl Clone for BoundedExecutor[src]

impl Debug for BoundedExecutor[src]

Auto Trait Implementations

impl !RefUnwindSafe for BoundedExecutor

impl Send for BoundedExecutor

impl Sync for BoundedExecutor

impl Unpin for BoundedExecutor

impl !UnwindSafe for BoundedExecutor

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.