pub struct Blocking;Available on crate feature
blocking only.Expand description
Executes all code as soon as possible on a single thread.
Trait Implementations§
Source§impl<'src> Mode<'src> for Blocking
impl<'src> Mode<'src> for Blocking
Source§fn invoke<I, O, T>(&'src self, task: T, input: I) -> TaskOutput<'src, Self, O>
fn invoke<I, O, T>(&'src self, task: T, input: I) -> TaskOutput<'src, Self, O>
Execute the given task with this mode.
Source§fn spawn_blocking<O>(&self, f: impl FnOnce() -> O) -> Self::Output<O>where
O: Send + 'src,
fn spawn_blocking<O>(&self, f: impl FnOnce() -> O) -> Self::Output<O>where
O: Send + 'src,
Bind the result of the closure into an output, preferring to execute the
closure on a blocking thread pool if available.
Source§fn spawn_cpu<O>(&self, f: impl FnOnce() -> O) -> Self::Output<O>where
O: Send + 'src,
fn spawn_cpu<O>(&self, f: impl FnOnce() -> O) -> Self::Output<O>where
O: Send + 'src,
Bind the result of the closure into an output, preferring to execute the
closure on a work-stealing thread pool if available.
Source§fn spawn_io<O, Fut>(&self, f: impl FnOnce() -> Fut) -> Self::Output<O>
fn spawn_io<O, Fut>(&self, f: impl FnOnce() -> Fut) -> Self::Output<O>
Bind the result of the future into an output, preferring to execute the
future on an async runtime if the Mode provides one.
Source§fn join<AO, BO>(
&'src self,
a: impl FnOnce(&'src Self) -> Self::Output<AO> + Send + 'src,
b: impl FnOnce(&'src Self) -> Self::Output<BO> + Send + 'src,
) -> Self::Output<(AO, BO)>
fn join<AO, BO>( &'src self, a: impl FnOnce(&'src Self) -> Self::Output<AO> + Send + 'src, b: impl FnOnce(&'src Self) -> Self::Output<BO> + Send + 'src, ) -> Self::Output<(AO, BO)>
Dispatch multiple
Output, potentially in parallel.Source§fn then<I, O>(
&'src self,
input: Self::Output<I>,
f: impl FnOnce(&'src Self, I) -> Self::Output<O>,
) -> Self::Output<O>
fn then<I, O>( &'src self, input: Self::Output<I>, f: impl FnOnce(&'src Self, I) -> Self::Output<O>, ) -> Self::Output<O>
Given an
Output, apply the closure and generate a new
output.Source§fn map_result<I, E, O>(
&'src self,
input: Self::Output<Result<I, E>>,
f: impl FnOnce(&'src Self, I) -> Self::Output<O> + Send + 'src,
) -> Self::Output<Result<O, E>>
fn map_result<I, E, O>( &'src self, input: Self::Output<Result<I, E>>, f: impl FnOnce(&'src Self, I) -> Self::Output<O> + Send + 'src, ) -> Self::Output<Result<O, E>>
Source§fn map_option<I, O>(
&'src self,
input: Self::Output<Option<I>>,
f: impl FnOnce(&'src Self, I) -> Self::Output<O> + Send + 'src,
) -> Self::Output<Option<O>>
fn map_option<I, O>( &'src self, input: Self::Output<Option<I>>, f: impl FnOnce(&'src Self, I) -> Self::Output<O> + Send + 'src, ) -> Self::Output<Option<O>>
Source§fn map_iterator<I, O, II>(
&'src self,
input: Self::Output<II>,
f: impl Fn(&'src Self, I) -> Self::Output<O> + Send + 'src,
) -> Self::Output<impl Iterator<Item = O> + Send + 'src>
fn map_iterator<I, O, II>( &'src self, input: Self::Output<II>, f: impl Fn(&'src Self, I) -> Self::Output<O> + Send + 'src, ) -> Self::Output<impl Iterator<Item = O> + Send + 'src>
TODO doc iter
Source§fn and_then_result<I, E, O>(
&'src self,
input: Self::Output<Result<I, E>>,
f: impl FnOnce(&'src Self, I) -> Self::Output<Result<O, E>> + Send + 'src,
) -> Self::Output<Result<O, E>>
fn and_then_result<I, E, O>( &'src self, input: Self::Output<Result<I, E>>, f: impl FnOnce(&'src Self, I) -> Self::Output<Result<O, E>> + Send + 'src, ) -> Self::Output<Result<O, E>>
Auto Trait Implementations§
impl Freeze for Blocking
impl RefUnwindSafe for Blocking
impl Send for Blocking
impl Sync for Blocking
impl Unpin for Blocking
impl UnwindSafe for Blocking
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> 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