pub fn spawn_relaxed<T>(future: T) -> TaskHandle<T::Output> where
    T: Future + Send + 'static,
    T::Output: Send + 'static,
Expand description

Spawn a task on the tokio multi-threaded executor using “relaxed” semantics.

The TaskHandle returned by this function does not provide any ordering guarantees with respect to the underlying task. This may lead to logical races, and authors are expected to manually synchronize ordering via other means.

Examples

use structured_spawn::spawn_relaxed;

let value = 12usize;
let handle = spawn_relaxed(async move {
    value * value
});
assert_eq!(handle.await?, 144);