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: ExecutorType

Represents how the executor will work

§context: Context

The default context for the executor

Implementations§

source§

impl Executor

source

pub fn former() -> ExecutorFormer

Make former, variation of builder pattern to form structure defining values of fields step by step.

source§

impl Executor

source

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

source

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

source

pub fn command(&self, command: ExecutableCommand) -> Result<()>

Executes a command

Call command callback with context if it is necessary.

Trait Implementations§

source§

impl Debug for Executor

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Any for T
where T: Any,