Struct tokio_task_pool::Pool
source · pub struct Pool { /* private fields */ }Expand description
Task pool
Implementations§
source§impl Pool
impl Pool
pub fn with_id<I: Into<String>>(self, id: I) -> Self
pub fn id(&self) -> Option<&str>
sourcepub fn with_spawn_timeout(self, timeout: Duration) -> Self
pub fn with_spawn_timeout(self, timeout: Duration) -> Self
Sets spawn timeout
(ignored for unbounded)
sourcepub fn with_run_timeout(self, timeout: Duration) -> Self
pub fn with_run_timeout(self, timeout: Duration) -> Self
Sets the default task run timeout
sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sets both spawn and run timeouts
sourcepub fn available_permits(&self) -> Option<usize>
pub fn available_permits(&self) -> Option<usize>
Returns pool available task permits
sourcepub fn busy_permits(&self) -> Option<usize>
pub fn busy_permits(&self) -> Option<usize>
Returns pool busy task permits
sourcepub fn spawn<T>(&self, future: T) -> impl Future<Output = SpawnResult<T>> + '_where
T: Future + Send + 'static,
T::Output: Send + 'static,
pub fn spawn<T>(&self, future: T) -> impl Future<Output = SpawnResult<T>> + '_where T: Future + Send + 'static, T::Output: Send + 'static,
Spawns a future
sourcepub fn spawn_with_timeout<T>(
&self,
future: T,
timeout: Duration
) -> impl Future<Output = SpawnResult<T>> + '_where
T: Future + Send + 'static,
T::Output: Send + 'static,
pub fn spawn_with_timeout<T>( &self, future: T, timeout: Duration ) -> impl Future<Output = SpawnResult<T>> + '_where T: Future + Send + 'static, T::Output: Send + 'static,
Spawns a future with a custom timeout
sourcepub async fn spawn_task<T>(&self, task: Task<T>) -> SpawnResult<T>where
T: Future + Send + 'static,
T::Output: Send + 'static,
pub async fn spawn_task<T>(&self, task: Task<T>) -> SpawnResult<T>where T: Future + Send + 'static, T::Output: Send + 'static,
Spawns a task (a future which can have a custom ID and timeout)
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Pool
impl Send for Pool
impl Sync for Pool
impl Unpin for Pool
impl !UnwindSafe for Pool
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