parallel_reader 0.1.2

A utility for reading from a file (or any `Read` stream) and processing it by chunks, in parallel.
Documentation
  • Coverage
  • 100%
    7 out of 7 items documented1 out of 2 items with examples
  • Size
  • Source code size: 35.32 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.44 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • wfraser/parallel_reader
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • wfraser

parallel_reader

Crates.io docs.rs

A utility (with no dependencies) for reading from a file (or any Read stream) and processing it by chunks, in parallel.

This is useful if reading is not a bottleneck, and you have something slow to do with it that is easily parallelizable.

Examples might be:

  • hashing
  • compression
  • sending chunks over a network

This crate provides a function, read_stream_and_process_chunks_in_parallel that lets you give a Read stream, then specify a chunk size and number of threads, and some processing function, and it'll take care of reading the stream and assigning threads to work on chunks of it.

Your function can also return an error, and it'll stop the processing of the file early and return the error to you, including the chunk offset that it was on when it errored.

For now, this is only using synchronous, blocking I/O, but maybe in the future I'll add another function that uses async streams and runs futures in parallel. P/Rs are welcome.