pub fn run_source_file(path: impl AsRef<Path>) -> EmbeddedResult<RunOutcome>Examples found in repository?
examples/run_file.rs (line 14)
6fn main() -> Result<(), Box<dyn std::error::Error>> {
7 let mut args = env::args_os();
8 let binary = args.next().unwrap_or_default();
9 let Some(path) = args.next().map(PathBuf::from) else {
10 eprintln!("usage: {} <program.rss>", PathBuf::from(binary).display());
11 std::process::exit(64);
12 };
13
14 let RunOutcome::Halted { stack } = run_source_file(&path)?;
15 if let Some(value) = stack.last() {
16 eprintln!("final: {}", render_value(value));
17 }
18
19 Ok(())
20}