Trait rustler::thread::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.

Object Safety§

This trait is not object safe.

Implementors§