Module :: program_tools
Rust script runner — compile and execute Rust files as scripts with output capture.
To add to your project
Quick Start — programmatic (test use case)
Run a Rust file from a test with one expression and assert on its output:
use *;
let output = run_file.expect;
output.assert_stdout_eq;
Run inline source code without any files on disk:
use *;
let output = run_source.expect;
output.assert_stdout_contains;
Build the execution plan manually for full control:
use *;
let plan = former
.program
.source
.file_path
.data
.end
.end
.form;
let output = run.expect;
output.assert_exit_ok;
output.assert_stdout_eq;
Quick Start — CLI
# Run a Rust file as a script
# Run with release profile and a custom package name
Features
- Script execution — run any Rust file or Cargo project as a script; all Cargo complexity is hidden behind a single call
- Output capture — stdout and stderr are captured into separate buffers; compare with expected strings using assertion methods
- Artifact management — auto-generated Cargo.toml, isolated temp workspaces, optional persistent build cache across runs
- Test integration — single-expression invocations and panic-on-failure assertion methods designed for Rust test functions
- Configuration — all parameters (build profile, timeout, features, env vars, edition) accessible via both builder API and CLI flags