pub struct RuntimeManager { /* private fields */ }
Available on crate feature
async
only.Implementations§
Source§impl RuntimeManager
impl RuntimeManager
Sourcepub fn block_in_place_on<F>(&self, future: F) -> F::Outputwhere
F: Future,
pub fn block_in_place_on<F>(&self, future: F) -> F::Outputwhere
F: Future,
Shorthand for tokio::task::block_in_place(|| block_on(f))
. This is a variant of block_on
that is safe to call from if the current thread has already entered the async runtime, or
is a rayon thread.
§Safety
The tokio runtime flavor is multi-threaded.
Sourcepub fn block_on<F>(&self, future: F) -> F::Outputwhere
F: Future,
pub fn block_on<F>(&self, future: F) -> F::Outputwhere
F: Future,
Note: block_in_place_on
should be used instead if the current thread is a rayon thread or
has already entered the async runtime.
Sourcepub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
Spawns a future onto the Tokio runtime (see [tokio::runtime::Runtime::spawn
]).
pub fn spawn_blocking<F, R>(&self, f: F) -> JoinHandle<R>
Sourcepub async fn spawn_rayon<F, O>(&self, func: F) -> O
pub async fn spawn_rayon<F, O>(&self, func: F) -> O
Run a task on the rayon threadpool. To avoid deadlocks, if the current thread is already a
rayon thread, the task is executed on the current thread after tokio’s block_in_place
is
used to spawn another thread to poll futures.
Auto Trait Implementations§
impl !Freeze for RuntimeManager
impl RefUnwindSafe for RuntimeManager
impl Send for RuntimeManager
impl Sync for RuntimeManager
impl Unpin for RuntimeManager
impl UnwindSafe for RuntimeManager
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