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§
sourcefn spawn_async<F1, F2, T>(self, f: F1) -> Result<JoinHandle<T>>
fn spawn_async<F1, F2, T>(self, f: F1) -> Result<JoinHandle<T>>
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()
.
sourcefn 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.
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,
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.
sourcefn spawn_scoped_async<'scope, 'env, F1, F2, T>(
self,
scope: &'scope Scope<'scope, 'env>,
f: F1,
) -> Result<ScopedJoinHandle<'scope, T>>
fn spawn_scoped_async<'scope, 'env, F1, F2, T>( self, scope: &'scope Scope<'scope, 'env>, f: F1, ) -> Result<ScopedJoinHandle<'scope, T>>
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()
.
sourcefn 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.
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,
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.