mz_ore::task

Trait RuntimeExt

Source
pub trait RuntimeExt {
    // Required methods
    fn spawn_blocking_named<Function, Output, Name, NameClosure>(
        &self,
        nc: NameClosure,
        function: Function,
    ) -> JoinHandle<Output> 
       where Name: AsRef<str>,
             NameClosure: FnOnce() -> Name,
             Function: FnOnce() -> Output + Send + 'static,
             Output: Send + 'static;
    fn spawn_named<Fut, Name, NameClosure>(
        &self,
        _nc: NameClosure,
        future: Fut,
    ) -> JoinHandle<Fut::Output> 
       where Name: AsRef<str>,
             NameClosure: FnOnce() -> Name,
             Fut: Future + Send + 'static,
             Fut::Output: Send + 'static;
}
Available on crate feature async only.
Expand description

Extension methods for Runtime and Handle.

See the module docs for more information.

Required Methods§

Source

fn spawn_blocking_named<Function, Output, Name, NameClosure>( &self, nc: NameClosure, function: Function, ) -> JoinHandle<Output>
where Name: AsRef<str>, NameClosure: FnOnce() -> Name, Function: FnOnce() -> Output + Send + 'static, Output: Send + 'static,

Runs the provided closure with a name on a thread where blocking is acceptable.

See tokio::task::spawn_blocking and the module docs for more information.

Source

fn spawn_named<Fut, Name, NameClosure>( &self, _nc: NameClosure, future: Fut, ) -> JoinHandle<Fut::Output>
where Name: AsRef<str>, NameClosure: FnOnce() -> Name, Fut: Future + Send + 'static, Fut::Output: Send + 'static,

Spawns a new asynchronous task with a name.

See tokio::task::spawn and the module docs for more information.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl RuntimeExt for &Runtime

Source§

fn spawn_blocking_named<Function, Output, Name, NameClosure>( &self, nc: NameClosure, function: Function, ) -> JoinHandle<Output>
where Name: AsRef<str>, NameClosure: FnOnce() -> Name, Function: FnOnce() -> Output + Send + 'static, Output: Send + 'static,

Source§

fn spawn_named<Fut, Name, NameClosure>( &self, nc: NameClosure, future: Fut, ) -> JoinHandle<Fut::Output>
where Name: AsRef<str>, NameClosure: FnOnce() -> Name, Fut: Future + Send + 'static, Fut::Output: Send + 'static,

Source§

impl RuntimeExt for Handle

Source§

fn spawn_blocking_named<Function, Output, Name, NameClosure>( &self, nc: NameClosure, function: Function, ) -> JoinHandle<Output>
where Name: AsRef<str>, NameClosure: FnOnce() -> Name, Function: FnOnce() -> Output + Send + 'static, Output: Send + 'static,

Source§

fn spawn_named<Fut, Name, NameClosure>( &self, nc: NameClosure, future: Fut, ) -> JoinHandle<Fut::Output>
where Name: AsRef<str>, NameClosure: FnOnce() -> Name, Fut: Future + Send + 'static, Fut::Output: Send + 'static,

Source§

impl RuntimeExt for Arc<Runtime>

Source§

fn spawn_blocking_named<Function, Output, Name, NameClosure>( &self, nc: NameClosure, function: Function, ) -> JoinHandle<Output>
where Name: AsRef<str>, NameClosure: FnOnce() -> Name, Function: FnOnce() -> Output + Send + 'static, Output: Send + 'static,

Source§

fn spawn_named<Fut, Name, NameClosure>( &self, nc: NameClosure, future: Fut, ) -> JoinHandle<Fut::Output>
where Name: AsRef<str>, NameClosure: FnOnce() -> Name, Fut: Future + Send + 'static, Fut::Output: Send + 'static,

Implementors§