Trait JobSpawner

Source
pub trait JobSpawner {
    // Required method
    fn spawn<F: FnOnce() + Send + UnwindSafe + 'static>(job: F);
}
Expand description

A JobSpawner is a value that can run Rust code on non-Erlang system threads. Abstracts away details of thread management for spawn().

Note: Implementations of spawn() must call the closure on a thread that is not managed by the Erlang VM’s scheduler. Otherwise, rustler::thread::spawn() would try to send a message from an OwnedEnv on an Erlang thread, which would panic.

Required Methods§

Source

fn spawn<F: FnOnce() + Send + UnwindSafe + 'static>(job: F)

Run the given closure on another thread.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§