| Crates.io | comptools |
| lib.rs | comptools |
| version | 0.1.0 |
| created_at | 2022-02-24 15:52:56.726241+00 |
| updated_at | 2022-02-24 15:52:56.726241+00 |
| description | Create iterators using Python's list comprehesion style. |
| homepage | |
| repository | https://github.com/jeertmans/comptools |
| max_upload_size | |
| id | 538596 |
| size | 14,756 |
Macros for Python-like list comprehension creation of iterators.
Another Crate that tries to bring the simplicty of Python's syntax to Rust iterators.
The main macro is iter, and other macros are extensions of the latter.
Below, small examples of how the macros work:
use comptools::*;
let vec: Vec<u64> = vect![x*x; for x in 0..=10; if x % 2 == 0];
assert_eq!(vec, vec![0, 4, 16, 36, 64, 100]);
let sum: u64 = sum![x*x; for x in 1..; while x*x*x < 1234];
assert_eq!(sum, 385);
Contributions are more than welcome!