This is a bit of code I wrote in my Rust program:
macro_rules! tern {
(true, $one:expr, $_:expr) => { $one };
(false, $_:expr, $two:expr) => { $two };
}
This seems so blatantly useful it seems like it *ought* to be in the standard library, but to my knowledge it is not. Am I missing something? Does this four-liner exist somewhere well-known already?
(Explanation in next post)