Skip to main content

KernelProgram

Trait KernelProgram 

Source
pub trait KernelProgram: Send + Sync {
    // Required methods
    fn engine(&self) -> Engine;
    fn create_kernel(self: Arc<Self>) -> Box<dyn Kernel>;

    // Provided method
    fn as_interpreter(self: Arc<Self>) -> Option<Arc<PolydatProgram>> { ... }
}
Expand description

A program on some engine, shared across threads through an Arc; every kernel created from it computes the same values and owns its own inputs, buffers, and outputs.

Required Methods§

Source

fn engine(&self) -> Engine

The engine the program was built for.

Source

fn create_kernel(self: Arc<Self>) -> Box<dyn Kernel>

A kernel of this program for the calling thread. It starts from the program on every engine: every input at its declared default, whatever the kernel that became the program had been set to; every shared binding with a cell of its own.

Provided Methods§

Source

fn as_interpreter(self: Arc<Self>) -> Option<Arc<PolydatProgram>>

The interpreter’s program, when this is one: the graph a diagnostic describes node by node. None for a compiled engine’s program.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§