#[macro_export]
macro_rules! case_expr {
    // --- single-result arm ---
    ($pat:pat $(if $guard:expr)? => $res:expr) => {
        dptree::filter_map(|s| {
            if let $pat $(if $guard)? = s {
                Some($res)  // note: no tuple
            } else {
                None
            }
        })
    };
    // --- multi-result arm ---
    ($pat:pat $(if $guard:expr)? => ($($res:expr),*)) => {
        dptree::filter_map(|s| {
            if let $pat $(if $guard)? = s {
                Some(($($res,)*))
            } else {
                None
            }
        })
    };
    // --- boolean filter arm ---
    ($pat:pat $(if $guard:expr)?) => {
        dptree::filter(|s| matches!(s, $pat $(if $guard)?))
    };
}