| Crates.io | lower-macros |
| lib.rs | lower-macros |
| version | 0.2.8 |
| created_at | 2025-01-27 10:18:40.483664+00 |
| updated_at | 2025-03-12 05:59:29.459952+00 |
| description | desugar math where the compiler wont |
| homepage | |
| repository | https://github.com/bend-n/lower.git |
| max_upload_size | |
| id | 1532273 |
| size | 22,117 |
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.
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) }.