pub trait Inputs {
// Required method
fn read(&mut self, fn_name: &str, args: &Args) -> Result<Scalar, EvalError>;
}Expand description
How a runtime reads the cells its function depends on.
Required Methods§
Sourcefn read(&mut self, fn_name: &str, args: &Args) -> Result<Scalar, EvalError>
fn read(&mut self, fn_name: &str, args: &Args) -> Result<Scalar, EvalError>
The value of the cell of function fn_name (fully qualified, <namespace>/<name>)
with arguments args, as of the evaluation’s asof.
Checks that fn_name is in the descriptor’s inputs (EvalError::UndeclaredInput),
resolves it as of the evaluation’s asof (EvalError::NameUnresolved), gets the cell
through the engine and records the receipt used (it becomes one of the computed
receipt’s inputs), and returns its value. Costs one unit of fuel.
EvalError::Suspended: the input is a computed cell not evaluated yet; return it
(with ?): the engine evaluates the input and calls the runtime again.
EvalError::InputNotCovered: the input has no value as of the asof, so neither has
the cell being evaluated, whatever the runtime returns next (a receipt cannot list an
absence among its inputs).
The asof itself is deliberately not offered: a value may depend on time only through the inputs it reads, which is what makes memoised versions checkable.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".