pub struct Builder { /* private fields */ }
Available on crate feature
multitask
only.Expand description
Thread factory, which can be used in order to configure the properties of a new thread.
Methods can be chained on it in order to configure it.
Implementations§
source§impl Builder
impl Builder
sourcepub const fn new() -> Builder
pub const fn new() -> Builder
Generates the base configuration for spawning a thread, from which configuration methods can be chained.
sourcepub fn stack_size(self, size: usize) -> Builder
pub fn stack_size(self, size: usize) -> Builder
Sets the size of the stack (in bytes) for the new thread.
sourcepub fn spawn<F, T>(self, f: F) -> Result<JoinHandle<T>>
pub fn spawn<F, T>(self, f: F) -> Result<JoinHandle<T>>
Spawns a new thread by taking ownership of the Builder
, and returns an
io::Result
to its JoinHandle
.
The spawned thread may outlive the caller (unless the caller thread is the main thread; the whole process is terminated when the main thread finishes). The join handle can be used to block on termination of the spawned thread.
Trait Implementations§
Auto Trait Implementations§
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