pub struct AsyncPool<F> { /* private fields */ }
Expand description
AsyncPool
is a thread-based executor that runs asynchronous tasks on dedicated worker threads.
The pool collects tasks through a bounded channel and distributes them among threads, each of which runs its own Tokio executor. This design enables controlled concurrency and efficient use of system resources.
Implementations§
Source§impl<F> AsyncPool<F>
impl<F> AsyncPool<F>
Sourcepub fn metrics(&self) -> AsyncPoolMetrics<'_>
pub fn metrics(&self) -> AsyncPoolMetrics<'_>
Returns the AsyncPoolMetrics
that are updated by the pool.
Source§impl<F> AsyncPool<F>
impl<F> AsyncPool<F>
Sourcepub fn new<S>(builder: AsyncPoolBuilder<S>) -> Result<Self>where
S: ThreadSpawn,
pub fn new<S>(builder: AsyncPoolBuilder<S>) -> Result<Self>where
S: ThreadSpawn,
Creates a new AsyncPool
based on the configuration specified by AsyncPoolBuilder
.
This method initializes the dedicated worker threads and configures each executor with the defined concurrency limits.
Sourcepub async fn spawn_async(&self, future: F)
pub async fn spawn_async(&self, future: F)
Trait Implementations§
Auto Trait Implementations§
impl<F> Freeze for AsyncPool<F>
impl<F> RefUnwindSafe for AsyncPool<F>
impl<F> Send for AsyncPool<F>where
F: Send,
impl<F> Sync for AsyncPool<F>where
F: Send,
impl<F> Unpin for AsyncPool<F>
impl<F> UnwindSafe for AsyncPool<F>
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