Struct foxbox_thinkerbell::run::Execution
[−]
[src]
pub struct Execution<Env> where Env: ExecutableDevEnv + 'static {
// some fields omitted
}
Running and controlling a single script.
Methods
impl<Env> Execution<Env> where Env: ExecutableDevEnv + 'static
fn new() -> Self
fn start<S>(&mut self, env: Env, script: Script<UncheckedCtx>, on_event: S) -> Result<(), Error> where S: ExtSender<ExecutionEvent> + Clone
Start executing the script.
Memory warning
If you do not consume the values from on_event
, they will remain stored forever.
You have been warned.
Errors
The first event sent to on_event
is a ExecutionEvent::Starting
, which informs the
caller of whether the execution could start. Possible reasons that would prevent execution
are:
- RunningError:AlreadyRunning
if the script is already running;
- a compilation error if the script was incorrect.
fn stop<F>(&mut self, on_result: F) where F: Fn(Result<(), Error>) + Send + 'static
Stop executing the script, asynchronously.
Errors
Produces RunningError:NotRunning if the script is not running yet.