pub trait KernelProgram: Send + Sync {
// Required methods
fn engine(&self) -> Engine;
fn create_uninitialized(self: Arc<Self>) -> Box<dyn Kernel>;
fn ledger(&self) -> &Arc<CompileLedger> ⓘ;
fn program_id(&self) -> ProgramId;
// Provided methods
fn create_kernel(self: Arc<Self>) -> Box<dyn Kernel> { ... }
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§
Sourcefn create_uninitialized(self: Arc<Self>) -> Box<dyn Kernel>
fn create_uninitialized(self: Arc<Self>) -> Box<dyn Kernel>
A kernel of this program whose consts are not yet evaluated: what a binder creates, writes the enclosing scope’s values into, and then initializes, so the consts are evaluated once, from the bound values.
Sourcefn ledger(&self) -> &Arc<CompileLedger> ⓘ
fn ledger(&self) -> &Arc<CompileLedger> ⓘ
The compile ledger of the program tree this program belongs to.
Sourcefn program_id(&self) -> ProgramId
fn program_id(&self) -> ProgramId
This program’s identity, equal to Kernel::program_id of every
kernel created from it.
Provided Methods§
Sourcefn create_kernel(self: Arc<Self>) -> Box<dyn Kernel>
fn create_kernel(self: Arc<Self>) -> Box<dyn Kernel>
A kernel of this program for the calling thread, initialized. 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; and
every const evaluated from those inputs (Kernel::init).
§Panics
When a const’s expression fails. A const is evaluated when a kernel is initialized, so a const that fails makes creation fail; the build of the program evaluated the same consts from the same defaults, so this happens only for a const that reads something outside the program, such as a clock or the environment.
Sourcefn as_interpreter(self: Arc<Self>) -> Option<Arc<PolydatProgram>>
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".