aboutsummaryrefslogtreecommitdiff
path: root/examples/example-picker
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-05-16 16:24:55 +0800
committer魏曹先生 <1992414357@qq.com>2026-05-16 16:24:55 +0800
commita5647e89bc5110a07c8f3c695c3c9582aa31d354 (patch)
tree63c5be475c53b578c7ff5fe0d454899c0aa315b1 /examples/example-picker
parentf7964129a5b5e41fd6da0f191a7e37e93bd36814 (diff)
Simplify example imports to use prelude and add resources example
Add a new example demonstrating global resource injection in chain functions, and update all existing examples to import from `mingling::prelude` instead of individual macro paths. Also add `example-resources` to the workspace exclude list.
Diffstat (limited to 'examples/example-picker')
-rw-r--r--examples/example-picker/src/main.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/examples/example-picker/src/main.rs b/examples/example-picker/src/main.rs
index fa895fc..e5bf403 100644
--- a/examples/example-picker/src/main.rs
+++ b/examples/example-picker/src/main.rs
@@ -17,10 +17,7 @@
//! cargo run --manifest-path ./examples/example-picker/Cargo.toml -- pick --age 99
//! ```
-use mingling::{
- macros::{chain, dispatcher, gen_program, pack, r_println, renderer},
- parser::Picker,
-};
+use mingling::prelude::*;
dispatcher!("pick", PickCommand => PickEntry);
@@ -35,9 +32,7 @@ pack!(ParsedPickInput = (i32, String));
#[chain]
fn parse(prev: PickEntry) -> NextProcess {
- // Extract arguments from `PickEntry`'s inner and create a `Picker`
- let picker = Picker::new(prev.inner);
- let picked = picker
+ let picked = prev
// First extract the named argument
.pick_or("--age", 20)
.after(|n: i32| n.clamp(0, 100))