From 5254d7561813ba50e07928b7d86e65be04a4f2e5 Mon Sep 17 00:00:00 2001 From: John-John Tedro Date: Wed, 16 Dec 2020 02:32:10 +0100 Subject: [PATCH] Bump README --- README.md | 21 +++++++-------------- crates/rune/README.md | 21 +++++++-------------- crates/rune/src/lib.rs | 4 ++-- scripts/hello_world.rn | 2 +- 4 files changed, 17 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 141728fd9..b93bb7263 100644 --- a/README.md +++ b/README.md @@ -77,14 +77,14 @@ you are working on it. You can run Rune programs with the bundled CLI: ``` -cargo run --bin rune -- scripts/hello_world.rn +cargo run --bin rune -- run scripts/hello_world.rn ``` If you want to see detailed diagnostics of your program while it's running, you can use: ``` -cargo run --bin rune -- scripts/hello_world.rn --dump-unit --trace --dump-vm +cargo run --bin rune -- run scripts/hello_world.rn --dump-unit --trace --dump-vm ``` See `--help` for more information. @@ -122,23 +122,16 @@ async fn main() -> Result<(), Box> { "#, )); - let mut errors = rune::Errors::new(); - let mut warnings = rune::Warnings::new(); + let mut diagnostics = rune::Diagnostics::new(); - let unit = match rune::load_sources(&context, &options, &mut sources, &mut errors, &mut warnings) { - Ok(unit) => unit, - Err(rune::LoadSourcesError) => { - let mut writer = StandardStream::stderr(ColorChoice::Always); - errors.emit_diagnostics(&mut writer, &sources)?; - return Ok(()); - } - }; + let result = rune::load_sources(&context, &options, &mut sources, &mut diagnostics); - if !warnings.is_empty() { + if !diagnostics.is_empty() { let mut writer = StandardStream::stderr(ColorChoice::Always); - warnings.emit_diagnostics(&mut writer, &sources)?; + diagnostics.emit_diagnostics(&mut writer, &sources)?; } + let unit = result?; let vm = Vm::new(Arc::new(context.runtime()), Arc::new(unit)); let mut execution = vm.execute(&["calculate"], (10i64, 20i64))?; diff --git a/crates/rune/README.md b/crates/rune/README.md index 141728fd9..b93bb7263 100644 --- a/crates/rune/README.md +++ b/crates/rune/README.md @@ -77,14 +77,14 @@ you are working on it. You can run Rune programs with the bundled CLI: ``` -cargo run --bin rune -- scripts/hello_world.rn +cargo run --bin rune -- run scripts/hello_world.rn ``` If you want to see detailed diagnostics of your program while it's running, you can use: ``` -cargo run --bin rune -- scripts/hello_world.rn --dump-unit --trace --dump-vm +cargo run --bin rune -- run scripts/hello_world.rn --dump-unit --trace --dump-vm ``` See `--help` for more information. @@ -122,23 +122,16 @@ async fn main() -> Result<(), Box> { "#, )); - let mut errors = rune::Errors::new(); - let mut warnings = rune::Warnings::new(); + let mut diagnostics = rune::Diagnostics::new(); - let unit = match rune::load_sources(&context, &options, &mut sources, &mut errors, &mut warnings) { - Ok(unit) => unit, - Err(rune::LoadSourcesError) => { - let mut writer = StandardStream::stderr(ColorChoice::Always); - errors.emit_diagnostics(&mut writer, &sources)?; - return Ok(()); - } - }; + let result = rune::load_sources(&context, &options, &mut sources, &mut diagnostics); - if !warnings.is_empty() { + if !diagnostics.is_empty() { let mut writer = StandardStream::stderr(ColorChoice::Always); - warnings.emit_diagnostics(&mut writer, &sources)?; + diagnostics.emit_diagnostics(&mut writer, &sources)?; } + let unit = result?; let vm = Vm::new(Arc::new(context.runtime()), Arc::new(unit)); let mut execution = vm.execute(&["calculate"], (10i64, 20i64))?; diff --git a/crates/rune/src/lib.rs b/crates/rune/src/lib.rs index cba72a572..8d13e683f 100644 --- a/crates/rune/src/lib.rs +++ b/crates/rune/src/lib.rs @@ -75,14 +75,14 @@ //! You can run Rune programs with the bundled CLI: //! //! ```text -//! cargo run --bin rune -- scripts/hello_world.rn +//! cargo run --bin rune -- run scripts/hello_world.rn //! ``` //! //! If you want to see detailed diagnostics of your program while it's running, //! you can use: //! //! ```text -//! cargo run --bin rune -- scripts/hello_world.rn --dump-unit --trace --dump-vm +//! cargo run --bin rune -- run scripts/hello_world.rn --dump-unit --trace --dump-vm //! ``` //! //! See `--help` for more information. diff --git a/scripts/hello_world.rn b/scripts/hello_world.rn index 8039a8631..085a78b68 100644 --- a/scripts/hello_world.rn +++ b/scripts/hello_world.rn @@ -1,3 +1,3 @@ pub fn main() { - println("Hello World"); + println!("Hello World"); }