Skip to main content

Compute

Trait Compute 

Source
pub trait Compute: Send + Sync {
    // Required method
    fn spawn(&self, job: Job);

    // Provided method
    fn runs_inline(&self) -> bool { ... }
}
Expand description

Where decode batches run. Implemented for any Fn(Job): |job| rayon::spawn(job), |job| { tokio::task::spawn_blocking(job); }, or Inline to run on the calling task (single-threaded hosts, tiny images).

Required Methods§

Source

fn spawn(&self, job: Job)

Run job somewhere; the driver awaits its result.

Provided Methods§

Source

fn runs_inline(&self) -> bool

Whether spawn would run the job right here, on the calling task. The drivers then call the batch directly, without boxing it or creating a channel for its result. Default false.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Compute for Inline

Source§

impl<F: Fn(Job) + Send + Sync> Compute for F