pub struct Dispatcher { /* private fields */ }
Expand description
The dispatcher. It manages the threads and dispatches the tasks.
Implementations§
Source§impl Dispatcher
impl Dispatcher
Sourcepub fn builder() -> DispatcherBuilder
pub fn builder() -> DispatcherBuilder
Create a builder to build a dispatcher.
Sourcepub fn dispatch<Fn, Fut, R>(
&self,
f: Fn,
) -> Result<Receiver<R>, DispatchError<Fn>>
pub fn dispatch<Fn, Fut, R>( &self, f: Fn, ) -> Result<Receiver<R>, DispatchError<Fn>>
Sourcepub fn dispatch_blocking<Fn, R>(
&self,
f: Fn,
) -> Result<Receiver<R>, DispatchError<Fn>>
pub fn dispatch_blocking<Fn, R>( &self, f: Fn, ) -> Result<Receiver<R>, DispatchError<Fn>>
Dispatch a blocking task to the threads.
Blocking pool of the dispatcher will be obtained from the proactor builder. So any configuration of the proactor’s blocking pool will be applied to the dispatcher.
§Error
If all threads are busy and the thread pool is full, this method will
return an error with the original closure. The limit can be configured
with DispatcherBuilder::proactor_builder
and
ProactorBuilder::thread_pool_limit
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dispatcher
impl !RefUnwindSafe for Dispatcher
impl Send for Dispatcher
impl Sync for Dispatcher
impl Unpin for Dispatcher
impl !UnwindSafe for Dispatcher
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