turnip-1.1.1 has been yanked.
turnip-rs
Ternary operators (turnips) for Rust.
Rather than creating a functional procedural macro to parse yet-another domain-specific syntax (a language within a language), turnip provides the simplest possible solution. The result is recursion without additional function calls and consistency with Rust syntax rules, which does not support overloading the ? and : operators.
The solution is a single 10-line macro defined using macro_rules!. See for yourself. Unlike other solutions out there, such as terny, tern, iffy and ternop, turnip combines simplicity with built-in support for recursion to more closely match a ternary operator design pattern.
What more do you need?
Installation
$ cargo add turnip
Usage
use ifelse;
License
MIT License