Crates.io | cmp_macro |
lib.rs | cmp_macro |
version | 0.1.0 |
source | src |
created_at | 2022-02-20 16:03:28.949505 |
updated_at | 2022-02-20 16:03:28.949505 |
description | This macro allows you to write a summary comparison, just like in Python. |
homepage | |
repository | https://github.com/Namacha411/cmp-macro |
max_upload_size | |
id | 535808 |
size | 20,665 |
This macro allows you to write a summary comparison, just like in Python.
use cmp_macro::{le, lety};
fn main() {
let x = 3;
if le!(1, x, 4) {
println!("1 <= x <= 4");
}
if lety!(i32; -2.0, -1, x, 4, 5.0) {
println!("-2 <= -1 <= x <= 4 <= 5");
}
}