pub struct Dispatcher { /* private fields */ }Available on crate feature
dispatcher only.Expand description
The dispatcher. It manages the threads and dispatches the tasks.
Implementations§
Source§impl Dispatcher
impl Dispatcher
Sourcepub fn new() -> Result<Dispatcher, Error>
pub fn new() -> Result<Dispatcher, Error>
Create the dispatcher with default config.
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
§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