#progress #iterator #rayon #logging

bin+lib iter-log

Logs the progress of iterations, both for sequential and parallel (Rayon) iterators

7 releases

0.2.2 Feb 6, 2025
0.2.1 Feb 6, 2025
0.1.3 Feb 6, 2025
0.1.2 Jan 30, 2025

#415 in Debugging

Download history 389/week @ 2025-01-28 598/week @ 2025-02-04 171/week @ 2025-02-11

1,158 downloads per month
Used in fastatomstruct

MIT license

20KB
363 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

To enable, logging, set the environment variable ENABLE_ITER_LOG.

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