pub trait Executor {
// Required method
fn execute(
&mut self,
stmts: &[Stmt],
scope: &mut Scope,
) -> EvalResult<ExecResult>;
// Provided method
fn file_stat(&self, path: &Path) -> Option<DirEntry> { ... }
}Expand description
Trait for executing pipelines (command substitution).
This is implemented by higher layers (L6: Pipes & Jobs) to provide
actual command execution. The evaluator calls this when it encounters
a $(pipeline) expression.
Required Methods§
Sourcefn execute(
&mut self,
stmts: &[Stmt],
scope: &mut Scope,
) -> EvalResult<ExecResult>
fn execute( &mut self, stmts: &[Stmt], scope: &mut Scope, ) -> EvalResult<ExecResult>
Execute a command-substitution body — a block of statements (the full
grammar: pipelines, &&/|| chains, ;/newline sequences) — and return
its combined result.
The executor should:
- Run each statement, accumulating stdout/stderr
- Carry the last statement’s exit code and structured data through
- Return an ExecResult with code, output, and parsed data
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".