Crate rsbatch_maestro

source ·
Expand description

§Batch Maestro

A Rust crate for flexible batch splitting and management with various strategies.

This crate provides a comprehensive set of functions to divide a total number into batches, offering different splitting strategies to suit various scenarios such as task distribution, load balancing, and resource allocation.

§Features

  • Even and uneven splitting of totals into batches
  • Splitting by count, with remainder, or based on weights
  • Range-based splitting and optimization
  • Minimum batch size enforcement
  • Batch merging and rebalancing

§Usage

use batch_maestro::even_split;

fn main() {
    match even_split(128, 8) {
        Ok((num_batches, batch_sizes)) => {
            println!("Number of batches: {}", num_batches);
            println!("Batch sizes: {:?}", batch_sizes);
        },
        Err(e) => println!("Error: {}", e),
    }
}

For more information and examples, please visit the GitHub repository.

Functions§

  • Splits a total number into even batches.
  • Finds the most even split possible within a given range of batch counts.
  • Splits a total number into a specified number of batches.
  • Generates a range of possible split configurations based on a min and max batch size.
  • Splits the total based on provided weights for each batch.
  • Splits a total number into even batches, ensuring each batch meets a minimum size requirement.
  • Splits a total number into even batches, returning the remainder separately.