pub struct ThreadBuilder {
th: Box<Thread>,
}Expand description
A struct to build a new thread.
Fields§
§th: Box<Thread>Implementations§
Source§impl ThreadBuilder
impl ThreadBuilder
Sourcepub fn new<I>(name: I) -> Selfwhere
String: From<I>,
pub fn new<I>(name: I) -> Selfwhere
String: From<I>,
Create a new thread builder for thread name.
Sourcepub fn attach_task(self, task: Box<dyn Task>) -> Self
pub fn attach_task(self, task: Box<dyn Task>) -> Self
Attach a task to the thread.
Sourcepub fn spawn_as_parked<F: FnOnce() + Send + 'static>(
self,
thread_fn: F,
) -> ParkHandle
pub fn spawn_as_parked<F: FnOnce() + Send + 'static>( self, thread_fn: F, ) -> ParkHandle
Spawn the thread as a parked state.
Sourcepub fn spawn<F: FnOnce() + Send + 'static>(self, thread_fn: F) -> JoinHandle
pub fn spawn<F: FnOnce() + Send + 'static>(self, thread_fn: F) -> JoinHandle
Spawn the thread.