| Crates.io | iter-log |
| lib.rs | iter-log |
| version | 0.2.5 |
| created_at | 2025-01-30 15:07:24.986016+00 |
| updated_at | 2025-02-27 12:45:12.631003+00 |
| description | Logs the progress of iterations, both for sequential and parallel (Rayon) iterators |
| homepage | https://zivgitlab.uni-muenster.de/ag-salinga/rust-iterator-logging |
| repository | https://zivgitlab.uni-muenster.de/ag-salinga/rust-iterator-logging |
| max_upload_size | |
| id | 1536468 |
| size | 24,550 |
This project provides a library for logging the progress of iterations in Rust, both for sequential and parallel iterations.
Add the following line to your Cargo.toml file to include the library as a dependency:
[dependencies]
iter-log = "0.1"
To enable, logging, set the environment variable ENABLE_ITER_LOG.
Use the log_progress method to log the progress of a sequential iteration:
use iter_log::LogProgressExt;
let x: Vec<u32> = (1..=100).collect();
let _y: Vec<_> = x.iter().log_progress(20).map(|&xi| xi * 2).collect();
Use the log_progress method to log the progress of a parallel iteration:
use iter_log::LogProgressParExt;
use rayon::prelude::*;
let x: Vec<u32> = (1..=100).collect();
let _z: Vec<_> = x.par_iter().log_progress(20).map(|&xi| xi * 2).collect();
See the main.rs file for a complete example of how to use the library for both sequential and parallel iterations, including performance testing with and without logging.
This project is licensed under the MIT License.