aboutsummaryrefslogtreecommitdiff
path: root/examples/example-pack-err
diff options
context:
space:
mode:
Diffstat (limited to 'examples/example-pack-err')
-rw-r--r--examples/example-pack-err/Cargo.lock10
-rw-r--r--examples/example-pack-err/src/main.rs31
2 files changed, 26 insertions, 15 deletions
diff --git a/examples/example-pack-err/Cargo.lock b/examples/example-pack-err/Cargo.lock
index 258bdd7..26bad2b 100644
--- a/examples/example-pack-err/Cargo.lock
+++ b/examples/example-pack-err/Cargo.lock
@@ -18,9 +18,9 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
[[package]]
name = "just_fmt"
-version = "0.1.2"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5454cda0d57db59778608d7a47bff5b16c6705598265869fb052b657f66cf05e"
+checksum = "6170dccbc3ea15dfb7f2da964097f814aba1dd8f746d4ffc56f33245c38e6d96"
[[package]]
name = "memchr"
@@ -30,7 +30,7 @@ checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"
[[package]]
name = "mingling"
-version = "0.2.0"
+version = "0.3.0"
dependencies = [
"mingling_core",
"mingling_macros",
@@ -39,7 +39,7 @@ dependencies = [
[[package]]
name = "mingling_core"
-version = "0.2.0"
+version = "0.3.0"
dependencies = [
"just_fmt",
"serde",
@@ -48,7 +48,7 @@ dependencies = [
[[package]]
name = "mingling_macros"
-version = "0.2.0"
+version = "0.3.0"
dependencies = [
"just_fmt",
"proc-macro2",
diff --git a/examples/example-pack-err/src/main.rs b/examples/example-pack-err/src/main.rs
index 8716333..5bf5066 100644
--- a/examples/example-pack-err/src/main.rs
+++ b/examples/example-pack-err/src/main.rs
@@ -28,6 +28,7 @@
use mingling::prelude::*;
use mingling::setup::StructuralRendererSetup;
+use std::io::Write;
use std::path::PathBuf;
dispatcher!("find", CMDFind => EntryFind);
@@ -100,32 +101,42 @@ fn handle_find_structural(args: EntryFindStructural) -> Next {
/// Renders the successful result with the found directory path.
#[renderer]
-fn render_result_path(path: ResultPath) {
- r_println!("Found directory: {}", path.display());
+fn render_result_path(path: ResultPath) -> RenderResult {
+ let mut render_result = RenderResult::new();
+ writeln!(render_result, "Found directory: {}", path.display()).ok();
+ render_result
}
/// Renders the error when no search path is provided.
#[renderer]
-fn render_error_not_found(_: ErrorNotFound) {
- r_println!("Search path not provided");
+fn render_error_not_found(_: ErrorNotFound) -> RenderResult {
+ let mut render_result = RenderResult::new();
+ writeln!(render_result, "Search path not provided").ok();
+ render_result
}
/// Renders the error when the given path is not a directory.
#[renderer]
-fn render_error_not_dir(err: ErrorNotDir) {
- r_println!("Not a directory: {}", err.info.display());
+fn render_error_not_dir(err: ErrorNotDir) -> RenderResult {
+ let mut render_result = RenderResult::new();
+ writeln!(render_result, "Not a directory: {}", err.info.display()).ok();
+ render_result
}
/// Renders the structural error when no search path is provided.
#[renderer]
-fn render_error_not_found_structural(_: ErrorNotFoundStructural) {
- r_println!("Search path not provided");
+fn render_error_not_found_structural(_: ErrorNotFoundStructural) -> RenderResult {
+ let mut render_result = RenderResult::new();
+ writeln!(render_result, "Search path not provided").ok();
+ render_result
}
/// Renders the structural error when the given path is not a directory.
#[renderer]
-fn render_error_not_dir_structural(err: ErrorNotDirStructural) {
- r_println!("Not a directory: {}", err.info.display());
+fn render_error_not_dir_structural(err: ErrorNotDirStructural) -> RenderResult {
+ let mut render_result = RenderResult::new();
+ writeln!(render_result, "Not a directory: {}", err.info.display()).ok();
+ render_result
}
gen_program!();