#python #comparison #summary #write #macro #cmp #le

cmp_macro

This macro allows you to write a summary comparison, just like in Python

1 unstable release

0.1.0 Feb 20, 2022

#6 in #le

MIT/Apache

8KB
184 lines

cmp-macro

This macro allows you to write a summary comparison, just like in Python.

example

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");
    }
}

lib.rs:

cmp_macro

This macro allows you to write a summary comparison, just like in Python.

No runtime deps