merc_utilities 2.0.0

Internal MERC crate containing various utility functions.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
/// A macro to return the pat type of an enum class target, and panics otherwise.
///
/// Usage cast!(instance, type)
#[macro_export]
macro_rules! cast {
    ($target: expr, $pat: path) => {{
        if let $pat(a) = $target {
            a
        } else {
            panic!("mismatch variant when cast to {}", stringify!($pat));
        }
    }};
}