Function run_with_builder

Source
pub fn run_with_builder<F, T>(
    builder: Builder,
    blocking_fn: F,
) -> Result<(impl Future<Output = T>, JoinHandle<()>)>
where F: FnOnce() -> T + Send + 'static, T: Send + 'static,
Expand description

Executes a task in a new thread configured by a Builder, returning a Result wrapping a Future to .await the result and a JoinHandle to join on the thread.

See the crate-level documentation for details. Unlike run(), this function:

  • Receives a thread::Builder to configure the thread.
  • Returns an io::Result to report any failure in creating the thread.
  • Returns a thread::JoinHandle to join on the thread synchronously, in addition to the Future to .await the result.

ยงErrors

Returns Err if it fails to spawn a thread.