make_option/lib.rs
1#[macro_export]
2macro_rules! make_option {
3 (Option<$ty:ty>) => {
4 Option<$ty>
5 };
6 ($ty:ty) => {
7 Option<$ty>
8 }
9}
10
11#[macro_export]
12macro_rules! value_as_option {
13 (Option<$ty:ty>, $expr:expr) => {
14 $expr
15 };
16 ($ty:ty, $expr:expr) => {
17 Some($expr)
18 };
19}
20
21#[macro_export]
22macro_rules! value_maybe_as_option {
23 (Option<$ty:ty>, $_:expr, $expr:expr) => {
24 $expr
25 };
26 ($ty:ty, $expr:expr, $_:expr) => {
27 $expr
28 };
29}