Trait web_thread::web::BuilderExt

source ·
pub trait BuilderExt {
    // Required methods
    fn spawn_async<F1, F2, T>(self, f: F1) -> Result<JoinHandle<T>>
       where F1: 'static + FnOnce() -> F2 + Send,
             F2: 'static + Future<Output = T>,
             T: 'static + Send;
    fn spawn_with_message<F1, F2, T, M>(
        self,
        f: F1,
        message: M,
    ) -> Result<JoinHandle<T>>
       where F1: 'static + FnOnce(M) -> F2 + Send,
             F2: 'static + Future<Output = T>,
             T: 'static + Send,
             M: 'static + MessageSend;
    fn spawn_scoped_async<'scope, 'env, F1, F2, T>(
        self,
        scope: &'scope Scope<'scope, 'env>,
        f: F1,
    ) -> Result<ScopedJoinHandle<'scope, T>>
       where F1: 'scope + FnOnce() -> F2 + Send,
             F2: 'scope + Future<Output = T>,
             T: 'scope + Send;
    fn spawn_scoped_with_message<'scope, 'env, F1, F2, T, M>(
        self,
        scope: &'scope Scope<'scope, 'env>,
        f: F1,
        message: M,
    ) -> Result<ScopedJoinHandle<'scope, T>>
       where F1: 'scope + FnOnce(M) -> F2 + Send,
             F2: 'scope + Future<Output = T>,
             T: 'scope + Send,
             M: 'scope + MessageSend;
}
Available on Web only.
Expand description

Web-specific extension for web_thread::Builder.

Required Methods§

source

fn spawn_async<F1, F2, T>(self, f: F1) -> Result<JoinHandle<T>>
where F1: 'static + FnOnce() -> F2 + Send, F2: 'static + Future<Output = T>, T: 'static + Send,

Async version of Builder::spawn().

For a more complete documentation see spawn_async().

§Errors

If the main thread does not support spawning threads, see has_spawn_support().

source

fn spawn_with_message<F1, F2, T, M>( self, f: F1, message: M, ) -> Result<JoinHandle<T>>
where F1: 'static + FnOnce(M) -> F2 + Send, F2: 'static + Future<Output = T>, T: 'static + Send, M: 'static + MessageSend,

Available on crate feature message only.

spawn_async() with message.

For a more complete documentation see spawn_with_message().

§Errors
  • If the main thread does not support spawning threads, see has_spawn_support().
  • If message was unable to be cloned.
source

fn spawn_scoped_async<'scope, 'env, F1, F2, T>( self, scope: &'scope Scope<'scope, 'env>, f: F1, ) -> Result<ScopedJoinHandle<'scope, T>>
where F1: 'scope + FnOnce() -> F2 + Send, F2: 'scope + Future<Output = T>, T: 'scope + Send,

Async version of Builder::spawn_scoped().

For a more complete documentation see Scope::spawn_async().

§Errors

If the main thread does not support spawning threads, see has_spawn_support().

source

fn spawn_scoped_with_message<'scope, 'env, F1, F2, T, M>( self, scope: &'scope Scope<'scope, 'env>, f: F1, message: M, ) -> Result<ScopedJoinHandle<'scope, T>>
where F1: 'scope + FnOnce(M) -> F2 + Send, F2: 'scope + Future<Output = T>, T: 'scope + Send, M: 'scope + MessageSend,

Available on crate feature message only.

BuilderExt::spawn_scoped_async() with message.

For a more complete documentation see Scope::spawn_with_message().

§Errors
  • If the main thread does not support spawning threads, see has_spawn_support().
  • If message was unable to be cloned.

Object Safety§

This trait is not object safe.

Implementors§