pub trait Runtime: Send + Sync {
// Required methods
fn lang(&self) -> &str;
fn evaluate(
&self,
descriptor: &Descriptor,
cell: &Cell,
inputs: &mut dyn Inputs,
budget: &mut Budget,
) -> Result<Scalar, EvalError>;
}Expand description
The evaluator of one function language (code.lang of a descriptor).
evaluate computes the value of cell (a cell of the function descriptor describes;
cell.fn_hash is the descriptor’s hash) from the cell’s arguments and from the values of
other cells, which it reads through inputs. It must be a pure function of those: no
clock, no randomness, no I/O. It charges its work to budget and propagates every error
inputs and budget return (see EvalError).
It may be called more than once for one cell in one request: when it reads an input that
is not available yet, read returns EvalError::Suspended, the engine evaluates the
input, then calls evaluate again from the start (reads already made are then answered at
once). So evaluate must not have side effects either.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".