Struct web_thread::Builder
source · pub struct Builder(/* private fields */);
Expand description
See std::thread::Builder
.
Implementations§
source§impl Builder
impl Builder
sourcepub fn spawn<F, T>(self, f: F) -> Result<JoinHandle<T>>
pub fn spawn<F, T>(self, f: F) -> Result<JoinHandle<T>>
See std::thread::Builder::spawn()
.
§Errors
If the main thread does not support spawning threads, see
web::has_spawn_support()
.
sourcepub fn spawn_scoped<'scope, 'env, F, T>(
self,
scope: &'scope Scope<'scope, 'env>,
f: F,
) -> Result<ScopedJoinHandle<'scope, T>>
pub fn spawn_scoped<'scope, 'env, F, T>( self, scope: &'scope Scope<'scope, 'env>, f: F, ) -> Result<ScopedJoinHandle<'scope, T>>
See std::thread::Builder::spawn_scoped()
.
§Errors
If the main thread does not support spawning threads, see
web::has_spawn_support()
.
sourcepub fn stack_size(self, size: usize) -> Self
pub fn stack_size(self, size: usize) -> Self
See std::thread::Builder::stack_size()
.
§Notes
Stack size will be round up to the nearest multiple of the WebAssembly page size, which is 64 Ki.
Trait Implementations§
source§impl BuilderExt for Builder
Available on Web
only.
impl BuilderExt for Builder
Available on
Web
only.source§fn 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()
. Read moresource§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_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.source§fn 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()
. Read moresource§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,
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.Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
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