diff -r 0fabd0b5914c -r cc0c6a8d0933 src/metaprogramming.rs --- a/src/metaprogramming.rs Thu May 01 01:55:57 2025 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/*! -Metaprogramming tools -*/ - -/// Reference `x` if so indicated by the first parameter. -/// Typically to be used from another macro. -/// -/// ```ignore -/// maybe_ref!(ref, V) // ➡ &V -/// maybe_ref!(noref, V) // ➡ V -/// ``` -macro_rules! maybe_ref { - (ref, $x:expr) => { - &$x - }; - (noref, $x:expr) => { - $x - }; - (ref, $x:ty) => { - &$x - }; - (noref, $x:ty) => { - $x - }; -} - -/// Choose `a` if first argument is the literal `ref`, otherwise `b`. -// macro_rules! ifref { -// (noref, $a:expr, $b:expr) => { -// $b -// }; -// (ref, $a:expr, $b:expr) => { -// $a -// }; -// } - -/// Annotate `x` with a lifetime if the first parameter -/// Typically to be used from another macro. -/// -/// ```ignore -/// maybe_ref!(ref, &'a V) // ➡ &'a V -/// maybe_ref!(noref, &'a V) // ➡ V -/// ``` -macro_rules! maybe_lifetime { - (ref, $x:ty) => { - $x - }; - (noref, &$lt:lifetime $x:ty) => { - $x - }; - (noref, &$x:ty) => { - $x - }; -}