2 releases

Uses new Rust 2024

new 0.1.4 May 14, 2025
0.1.3 May 13, 2025
0.1.2 May 12, 2025
0.1.1 May 12, 2025
0.1.0 May 12, 2025

#948 in Command line utilities

Download history 412/week @ 2025-05-08

419 downloads per month

MIT license

34KB
758 lines

RFS Runner (UI Progress boilerplate)

my helper

Features

  • Manages a pool of asynchronous workers.
  • Supports sending data to workers sequentially or to specific workers by ID.
  • Provides progress reporting capabilities using indicatif.
  • Handles graceful shutdown on SIGINT with WorkerPool::sigint hook.

Note: You'll need to replace rfs-runner with the actual name of your crate and ensure WorkerPool, DefaultTemplate, and MainProgress are correctly exposed from your library's public API. The example assumes DefaultTemplate is a struct implementing WorkerTemplate.

API

Key components:

  • WorkerPool<D, S>: Manages the workers.
    • new(num_cpus: usize, template: S): Creates a new pool.
    • spawn_worker<F, Fut>(&mut self, f: F) -> Uid: Spawns a new worker.
    • send_seqcst(&mut self, data: D) -> Result<(), D>: Sends data to the next available worker.
    • send_to(&mut self, id: Uid, data: D) -> Result<(), D>: Sends data to a specific worker.
    • join_all(self): Waits for all workers to finish.
    • sigint(&mut self): Handles SIGINT for graceful shutdown.
  • WorkerTemplate (trait): Defines the styling for progress bars.
    • DefaultTemplate is an example implementation.
  • MainProgress<S>: Handles progress bar creation and updates.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Project Link: rfs-runer

Dependencies

~5–14MB
~157K SLoC