pub struct Executor { /* private fields */ }Expand description
Single-threaded async executor.
Manages task lifecycle: spawn, poll, complete, free. Tasks are
allocated via Box (default) or slab (via spawn_slab). Each
task’s header contains a free_fn that knows how to deallocate
its own storage — the executor doesn’t know or care which
allocator was used.
Implementations§
Source§impl Executor
impl Executor
Sourcepub fn spawn_boxed<F>(&mut self, future: F) -> JoinHandle<F::Output> ⓘ
pub fn spawn_boxed<F>(&mut self, future: F) -> JoinHandle<F::Output> ⓘ
Spawn an async task via Box allocation. Returns a JoinHandle
that can be awaited for the task’s output.
Sourcepub fn task_count(&self) -> usize
pub fn task_count(&self) -> usize
Number of live tasks.
Sourcepub fn set_tasks_per_cycle(&mut self, limit: usize)
pub fn set_tasks_per_cycle(&mut self, limit: usize)
Set the maximum tasks to poll per cycle.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Executor
impl RefUnwindSafe for Executor
impl !Send for Executor
impl !Sync for Executor
impl Unpin for Executor
impl UnsafeUnpin for Executor
impl UnwindSafe for Executor
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