typst/src/macros.rs
2020-08-30 22:09:33 +02:00

11 lines
249 B
Rust

/// Unwrap the option if it is `Some(T)` or evaluate `$or` if it is `None`.
#[allow(unused)]
macro_rules! try_or {
($option:expr, $or:expr $(,)?) => {
match $option {
Some(v) => v,
None => $or,
}
};
}