Skip to main content

run_on_worker

Function run_on_worker 

Source
#[doc(hidden)]
pub fn run_on_worker<F, T>(f: F) -> Result<T, String>
where F: FnOnce() -> T + Send + 'static, T: Send + 'static,
Expand description

Run a closure on the worker thread with proper cleanup on panic.

Returns Ok(T) on success, Err(String) if the closure panicked. The caller handles the error (either tagged error value or Rf_errorcall).

Without the worker-thread feature, runs inline on the current thread.