summaryrefslogtreecommitdiff
path: root/engine/src/util.rs
blob: b1a98ca8cfa98a52b1989d5654a38c30b2355997 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
macro_rules! try_option {
    ($expr: expr) => {
        match $expr {
            Ok(value) => value,
            Err(err) => {
                return Some(Err(err.into()));
            }
        }
    };
}

pub(crate) use try_option;

macro_rules! or {
    (($($tt: tt)+) else ($($else_tt: tt)*)) => {
        $($tt)+
    };

    (() else ($($else_tt: tt)*)) => {
        $($else_tt)*
    };
}

pub(crate) use or;