Skip to main content

Executor

Struct Executor 

Source
pub struct Executor<R: CommandRunner> { /* private fields */ }
Expand description

Orchestration engine that walks a Program AST and applies shell-like execution semantics.

Generic over CommandRunner so the actual command dispatch is pluggable. The composition root wires in a concrete runner (e.g., a process spawner, a hook dispatcher, or a test double).

§Semantics

  • && / || — connect pipelines; the gate is the previous pipeline’s success.
  • | — pipe stdout of one command into the next.
  • |& — pipe stdout + stderr of one command into the next.
  • ? suffix — marks a command as optional; optional commands in sequence accumulate their outputs into a Context, which is serialized as JSON and passed to the first non-optional command that follows.
  • > / >> — redirect the final command’s stdout to a file.

Implementations§

Source§

impl<R: CommandRunner> Executor<R>

Source

pub fn new(runner: R) -> Self

Source

pub fn into_runner(self) -> R

Consume the executor and return the underlying runner.

Useful in tests to inspect what the runner recorded after execution.

Trait Implementations§

Auto Trait Implementations§

§

impl<R> Freeze for Executor<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for Executor<R>
where R: RefUnwindSafe,

§

impl<R> Send for Executor<R>
where R: Send,

§

impl<R> Sync for Executor<R>
where R: Sync,

§

impl<R> Unpin for Executor<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for Executor<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for Executor<R>
where R: UnwindSafe,

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>,

Source§

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>,

Source§

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.