1 unstable release

0.1.1 Feb 18, 2024
0.1.0 Feb 17, 2024

#1514 in Procedural macros

Download history 20/week @ 2024-07-25 6/week @ 2024-08-01 10/week @ 2024-09-19 8/week @ 2024-09-26

55 downloads per month

MIT license

13KB
335 lines

lower

lowers expressions to their "desugared" form.

e.g

a * b + c => (a.mul(b)).add(c)

note that it is extremely pervasive, so

lower::math! { fn main() -> u8 {
    const X: u8 = 31 * 2;
    return 2 * X + 2;
} }

expands to

fn main() -> u8 {
    const X: u8 = 31.mul(2);
    return (2.mul(X)).add(2);
}

it should work for most expressions.

why

well, you see, i made a crate for arrays. then, i added add/mul/…, and got annoyed when i had to call them manually. now, you can do amazing things such as lower::math! { 2 * ([5, 2] + 5) }.


lib.rs:

a lil macro crate.

provides a handy macro for converting a + b to a.add(b) for when you cant easily overload the Add trait.

Dependencies

~240–690KB
~16K SLoC