pub struct Executor {
pub kind: ExecutorType,
pub context: Context,
}Expand description
Executor that is responsible for executing the program’s commands.
It uses the given Context to store and retrieve values during runtime.
It takes an ExecutableCommand_ which contains subjects and properties that will be passed to the callback function of the associated command’s routine.
§Example:
let executor = Executor::former().form();
let executable_command = ExecutableCommand_
{
subjects : vec![ Value::String( "subject_value".to_string() ), /* ... */ ],
properties : HashMap::from_iter
([
( "prop_name".to_string(), Value::Number( 42.0 ) ),
/* ... */
]),
routine : Routine::new( |( args, props )| Ok( () ) )
};
assert!( executor.command( executable_command ).is_ok() );Fields§
§kind: ExecutorTypeRepresents how the executor will work
context: ContextThe default context for the executor
Implementations§
source§impl Executor
impl Executor
sourcepub fn former() -> ExecutorFormer<Executor, ReturnContainer>
pub fn former() -> ExecutorFormer<Executor, ReturnContainer>
Make former, variation of builder pattern to form structure defining values of fields step by step.
source§impl Executor
impl Executor
sourcepub fn program(
&self,
program: Program<Namespace<ExecutableCommand_>>
) -> Result<()>
pub fn program( &self, program: Program<Namespace<ExecutableCommand_>> ) -> Result<()>
Executes a program
Setup runtimes for each namespace into program and run it with specified execution type
sourcepub fn namespace(&self, namespace: Namespace<ExecutableCommand_>) -> Result<()>
pub fn namespace(&self, namespace: Namespace<ExecutableCommand_>) -> Result<()>
Executes a namespace
Configure Runtime and run commands from namespace at runtime position while it isn’t finished
sourcepub fn command(&self, command: ExecutableCommand_) -> Result<()>
pub fn command(&self, command: ExecutableCommand_) -> Result<()>
Executes a command
Call command callback with context if it is necessary.