summaryrefslogtreecommitdiff
path: root/src/macros.rs
blob: 3cccfc6758b5b6a45464b21dffd86c25561f6e53 (plain) (blame)
1
2
3
4
5
6
7
8
9
/// Unwrap the option if it is `Some(T)` or evaluate `$or` if it is `None`.
macro_rules! try_or {
    ($option:expr, $or:expr $(,)?) => {
        match $option {
            Some(v) => v,
            None => $or,
        }
    };
}