Struct aarch64_std::thread::Builder

source ·
pub struct Builder { /* private fields */ }
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.

The two configurations available are:

  • [name]: specifies an [associated name for the thread][naming-threads]
  • [stack_size]: specifies the [desired stack size for the thread][stack-size]

The spawn method will take ownership of the builder and create an [io::Result] to the thread handle with the given configuration.

The [thread::spawn] free function uses a Builder with default configuration and [unwrap]s its return value.

You may want to use spawn instead of [thread::spawn], when you want to recover from a failure to launch a thread, indeed the free function will panic where the Builder method will return a [io::Result].

Implementations§

Generates the base configuration for spawning a thread, from which configuration methods can be chained.

Names the thread-to-be. Currently the name is used for identification only in panic messages.

The name must not contain null bytes (\0).

For more information about named threads, see [this module-level documentation][naming-threads].

Sets the size of the stack (in bytes) for the new thread.

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, including recovering its panics.

For a more complete documentation see thread::spawn.

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.