Struct bounded_executor::BoundedExecutor [−][src]
pub struct BoundedExecutor { /* fields omitted */ }Implementations
Create a new BoundedExecutor from an existing tokio [Handle]
with a maximum concurrent task capacity of capacity.
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.
pub async fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R> where
F: FnOnce() -> R + Send + 'static,
R: Send + 'static,
pub async fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R> where
F: FnOnce() -> R + Send + 'static,
R: Send + 'static,
Like BoundedExecutor::spawn but spawns the given closure onto a
blocking task (see [tokio::task::spawn_blocking] for details).
Like BoundedExecutor::try_spawn but spawns the given closure
onto a blocking task (see [tokio::task::spawn_blocking] for details).
Trait Implementations
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
Mutably borrows from an owned value. Read more