pub fn spawn<F>(future: F) -> JoinHandle<F::Output> ⓘExpand description
Spawns a future onto the current thread’s runtime
This is a convenience function that uses a thread-local runtime. For DLL boundary safety, create and use an explicit Runtime instead.
§Type Parameters
F- The future type
§Parameters
future- The future to execute
§Returns
A JoinHandle that can be used to await the future’s completion
§Example
use luminal::Runtime;
// Create an explicit runtime instead of using thread locals for doctests
let rt = Runtime::new().unwrap();
let handle = rt.spawn(async {
// Some async work
42
});