Struct AsyncifyPool
pub struct AsyncifyPool { /* private fields */ }Expand description
A thread pool to perform blocking operations in other threads.
Implementations§
§impl AsyncifyPool
impl AsyncifyPool
pub fn new(thread_limit: usize, recv_timeout: Duration) -> AsyncifyPool
pub fn new(thread_limit: usize, recv_timeout: Duration) -> AsyncifyPool
Create AsyncifyPool with thread number limit and channel receive
timeout.
pub fn dispatch<D>(&self, f: D) -> Result<(), DispatchError<D>>where
D: Dispatchable,
pub fn dispatch<D>(&self, f: D) -> Result<(), DispatchError<D>>where
D: Dispatchable,
Send a dispatchable, usually a closure, to another thread. Usually the user should not use it. When all threads are busy and thread number limit has been reached, it will return an error with the original dispatchable.
Trait Implementations§
§impl Clone for AsyncifyPool
impl Clone for AsyncifyPool
§fn clone(&self) -> AsyncifyPool
fn clone(&self) -> AsyncifyPool
Returns a duplicate 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 AsyncifyPool
impl RefUnwindSafe for AsyncifyPool
impl Send for AsyncifyPool
impl Sync for AsyncifyPool
impl Unpin for AsyncifyPool
impl UnwindSafe for AsyncifyPool
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
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