pub trait ContextLike {
// Required methods
fn start_closure(&mut self) -> [(Arc<str>, Arc<Value>); 2];
fn set_key(&mut self, index: usize, identifier: Arc<str>);
fn set_parameter(&mut self, index: usize, value: Arc<Value>);
fn end_closure(&mut self, stack: [(Arc<str>, Arc<Value>); 2]);
fn get_value(&mut self, reference: &Reference) -> Result<Arc<Value>>;
fn set_value(&mut self, identifier: &str, value: Arc<Value>) -> Result<()>;
fn function_call(
&mut self,
name: Arc<str>,
arg: Arc<Value>,
) -> Result<Arc<Value>>;
fn method_call(
&mut self,
name: Arc<str>,
value: Arc<Value>,
arg: Arc<Value>,
) -> Result<Arc<Value>>;
fn inference_call(
&mut self,
reference: Arc<Reference>,
arg: Arc<Value>,
) -> Result<Arc<Value>>;
fn run_evaluation(
&mut self,
start_state: Option<Arc<str>>,
) -> WorkflowStatus;
}Expand description
Evaluation context interface used by the AIMX engine.
Implementors provide:
- Reference lookup (
get_value/set_value). - Function and method dispatch via
FunctionRegistry. - Closure parameter stack management.
- Inference calls into workflows or closures.
- Imperative workflow execution via
ContextLike::run_evaluation.
Required Methods§
Sourcefn start_closure(&mut self) -> [(Arc<str>, Arc<Value>); 2]
fn start_closure(&mut self) -> [(Arc<str>, Arc<Value>); 2]
Start a new closure and save the current stack.
Sourcefn set_key(&mut self, index: usize, identifier: Arc<str>)
fn set_key(&mut self, index: usize, identifier: Arc<str>)
Set the identifier of a closure parameter slot (0 or 1).
Sourcefn set_parameter(&mut self, index: usize, value: Arc<Value>)
fn set_parameter(&mut self, index: usize, value: Arc<Value>)
Set the value of the index mapped parameter used by element-wise functions like map.
§Arguments
index- The index value to set (0 or 1)value- The value to set
Sourcefn end_closure(&mut self, stack: [(Arc<str>, Arc<Value>); 2])
fn end_closure(&mut self, stack: [(Arc<str>, Arc<Value>); 2])
End the closure and restore the previous stack.
Sourcefn method_call(
&mut self,
name: Arc<str>,
value: Arc<Value>,
arg: Arc<Value>,
) -> Result<Arc<Value>>
fn method_call( &mut self, name: Arc<str>, value: Arc<Value>, arg: Arc<Value>, ) -> Result<Arc<Value>>
Call a method on a value.
§Arguments
name- The name of the method to callvalue- The value on which to call the methodarg- The argument(s) to pass to the method (Value can be Empty, Literal, or Array)
§Returns
Returns the result of the method call or an error if the method is not found or if there’s an error during execution.
Sourcefn inference_call(
&mut self,
reference: Arc<Reference>,
arg: Arc<Value>,
) -> Result<Arc<Value>>
fn inference_call( &mut self, reference: Arc<Reference>, arg: Arc<Value>, ) -> Result<Arc<Value>>
Run inference on a referenced workflow.
§Arguments
reference- The workflow referencearg- The argument(s) to pass to the inference call (Value can be Empty, Literal, or Array)
§Returns
Returns the result of the inference call or an error if the workflow is not found or if there’s an error during execution.