Blocking

Struct Blocking 

Source
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

Source§

type Output<O> = O where O: Send + 'src

The output of this mode for a type.
Source§

fn invoke<I, O, T>(&'src self, task: T, input: I) -> TaskOutput<'src, Self, O>
where T: Task<'src, I, O>, O: Send + 'src,

Execute the given task with this mode.
Source§

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,

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>
where O: Send + 'src, Fut: Future<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)>
where AO: Send + 'src, BO: Send + 'src,

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>
where I: Send + 'src, O: Send + 'src,

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>>
where I: Send + 'src, E: Send + 'src, O: Send + 'src,

Given an Output wrapped in a Result, apply the closure only if the Result is Ok and generate a new output.
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>>
where I: Send + 'src, O: Send + 'src,

Given an Output wrapped in an Option, apply the closure only if the Option is Some and generate a new output.
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>
where O: Send + 'src, II: Iterator<Item = I> + 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>>
where I: Send + 'src, E: Send + 'src, O: Send + 'src,

Given an Output wrapped in a Result, apply the closure only if the Result is Ok and generate a new Result output.
Source§

fn and_then_option<I, O>( &'src self, input: Self::Output<Option<I>>, f: impl FnOnce(&'src Self, I) -> Self::Output<Option<O>> + Send + 'src, ) -> Self::Output<Option<O>>
where I: Send + 'src, O: Send + 'src,

Given an Output wrapped in a Result, apply the closure only if the Result is Ok and generate a new Result output.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.