iter-log 0.2.5

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

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.