3 releases
new 0.1.2 | Jan 30, 2025 |
---|---|
0.1.1 | Jan 30, 2025 |
0.1.0 | Jan 30, 2025 |
#441 in Debugging
44 downloads per month
Used in fastatomstruct
18KB
298 lines
Rust Iterator Logging
This project provides a library for logging the progress of iterations in Rust, both for sequential and parallel iterations.
Installation
Add the following line to your Cargo.toml
file to include the library as a dependency:
[dependencies]
iter-log = "0.1"
Usage
Sequential Iteration
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();
Parallel Iteration
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();
More examples
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.
License
This project is licensed under the MIT License.
Dependencies
~1.5MB
~25K SLoC