json-matcher 0.1.0

Utility library for declaratively matching JSON values
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use std::panic::UnwindSafe;

pub fn catch_string_panic<R, F>(f: F) -> String
where
    F: FnOnce() -> R + UnwindSafe,
{
    *std::panic::catch_unwind(f)
        .err()
        .unwrap()
        .downcast::<String>()
        .unwrap()
}