aboutsummaryrefslogtreecommitdiff
path: root/examples/example-panic-unwind
diff options
context:
space:
mode:
Diffstat (limited to 'examples/example-panic-unwind')
-rw-r--r--examples/example-panic-unwind/Cargo.lock31
-rw-r--r--examples/example-panic-unwind/Cargo.toml2
-rw-r--r--examples/example-panic-unwind/src/main.rs11
3 files changed, 28 insertions, 16 deletions
diff --git a/examples/example-panic-unwind/Cargo.lock b/examples/example-panic-unwind/Cargo.lock
index 6481eb4..20671f5 100644
--- a/examples/example-panic-unwind/Cargo.lock
+++ b/examples/example-panic-unwind/Cargo.lock
@@ -3,6 +3,23 @@
version = 4
[[package]]
+name = "arg-picker"
+version = "0.2.0"
+dependencies = [
+ "arg-picker-macros",
+ "just_fmt",
+]
+
+[[package]]
+name = "arg-picker-macros"
+version = "0.2.0"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.118",
+]
+
+[[package]]
name = "equivalent"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -57,16 +74,16 @@ dependencies = [
[[package]]
name = "mingling"
-version = "0.4.0"
+version = "0.5.0"
dependencies = [
+ "arg-picker",
"mingling_core",
"mingling_macros",
- "size",
]
[[package]]
name = "mingling_core"
-version = "0.4.0"
+version = "0.5.0"
dependencies = [
"just_fmt",
"might_be_async",
@@ -74,7 +91,7 @@ dependencies = [
[[package]]
name = "mingling_macros"
-version = "0.4.0"
+version = "0.5.0"
dependencies = [
"just_fmt",
"proc-macro2",
@@ -139,12 +156,6 @@ dependencies = [
]
[[package]]
-name = "size"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b6709c7b6754dca1311b3c73e79fcce40dd414c782c66d88e8823030093b02b"
-
-[[package]]
name = "syn"
version = "2.0.118"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/examples/example-panic-unwind/Cargo.toml b/examples/example-panic-unwind/Cargo.toml
index 559bdb9..463a288 100644
--- a/examples/example-panic-unwind/Cargo.toml
+++ b/examples/example-panic-unwind/Cargo.toml
@@ -5,7 +5,7 @@ edition = "2024"
[dependencies.mingling]
path = "../../mingling"
-features = ["parser"]
+features = ["picker"]
# Enable panic unwinding in release builds
[profile.release]
diff --git a/examples/example-panic-unwind/src/main.rs b/examples/example-panic-unwind/src/main.rs
index 2c432eb..f91b0f0 100644
--- a/examples/example-panic-unwind/src/main.rs
+++ b/examples/example-panic-unwind/src/main.rs
@@ -19,12 +19,13 @@ use mingling::config::PanicSilence;
use mingling::{hook::ProgramHook, prelude::*};
use std::io::Write;
-dispatcher!("panic", CMDPanic => EntryPanic);
-pack!(NotPanic = ());
+dispatcher!("panic", EntryPanic);
+
+#[derive(Grouped)]
+pub struct NotPanic;
fn main() {
let mut program = ThisProgram::new();
- program.with_dispatcher(CMDPanic);
// --------- IMPORTANT ---------
// Enable silence_panic to suppress automatic Panic output
@@ -42,13 +43,13 @@ fn main() {
#[chain]
fn handle_panic(prev: EntryPanic) -> Next {
- let panic_info = prev.pick::<Option<String>>(()).unpack();
+ let panic_info = prev.pick_or_default(&arg![Option<String>]).unwrap();
match panic_info {
Some(s) => {
// Panic happens here, will be caught
panic!("{}", s)
}
- None => NotPanic::default().into(),
+ None => NotPanic.into(),
}
}