#operator #ternary #syntax #lets #macro

conditional

Provides a conditional! macro which lets you use the syntax of the conditional operator (also known as the ternary operator) in Rust

2 releases

0.1.1 Sep 22, 2019
0.1.0 Sep 22, 2019

#2769 in Rust patterns

Download history 15/week @ 2024-01-18 163/week @ 2024-01-25 90/week @ 2024-02-01 30/week @ 2024-02-08 140/week @ 2024-02-15 260/week @ 2024-02-22 126/week @ 2024-02-29 56/week @ 2024-03-07 58/week @ 2024-03-14 37/week @ 2024-03-21 85/week @ 2024-03-28 88/week @ 2024-04-04 66/week @ 2024-04-11 20/week @ 2024-04-18

266 downloads per month

MIT/Apache

4KB

conditional

Crates.io Crates.io Crates.io Docs.io

Lets you use the syntax of the conditional operator in Rust. Also known as the ternary operator.

Examples

let x = conditional!(69 > 42 ? "hello" : "world");
assert_eq!(x, "hello");

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~1.5MB
~33K SLoC