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> UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more