Struct bounded_executor::BoundedExecutor
source · pub struct BoundedExecutor { /* private fields */ }
Implementations§
source§impl BoundedExecutor
impl BoundedExecutor
sourcepub fn new(capacity: usize, executor: Handle) -> Self
pub fn new(capacity: usize, executor: Handle) -> Self
Create a new BoundedExecutor
from an existing tokio [Handle
]
with a maximum concurrent task capacity of capacity
.
sourcepub fn try_spawn<F>(&self, f: F) -> Result<JoinHandle<F::Output>, F>
pub fn try_spawn<F>(&self, f: F) -> Result<JoinHandle<F::Output>, F>
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§
source§impl Clone for BoundedExecutor
impl Clone for BoundedExecutor
source§fn clone(&self) -> BoundedExecutor
fn clone(&self) -> BoundedExecutor
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for BoundedExecutor
impl !RefUnwindSafe for BoundedExecutor
impl Send for BoundedExecutor
impl Sync for BoundedExecutor
impl Unpin for BoundedExecutor
impl !UnwindSafe for BoundedExecutor
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more