3 releases
Uses new Rust 2024
| 0.2.2 | Jul 13, 2025 |
|---|---|
| 0.2.1 | Mar 31, 2025 |
| 0.2.0 | Feb 27, 2025 |
#8 in #file-pattern-matching
858 downloads per month
Used in 117 crates
(9 directly)
57KB
397 lines
batch-mode-batch-index
This crate provides utilities for handling batch indices in a batch processing environment. It defines the BatchIndex type, which can be either a Usize or a Uuid, and provides mechanisms to generate regular expressions (regex) for matching batch-related filenames based on these indices. The crate ensures the consistent handling of batch identifiers and file patterns throughout the batch processing lifecycle.
Key Features
- Batch Indexing: Define and manage batch indices using either numeric (
Usize) or UUID-based identifiers. - File Pattern Matching: Generate regex patterns for matching batch file names (input, output, error, metadata) that incorporate the batch index.
- Batch Index Type Conversion: Easily convert between
BatchIndexandBatchIndexType. - Edge Case Handling: Robust handling of edge cases for both numeric and UUID-based batch indices.
Usage
Creating a Batch Index
use batch_mode_batch_index::{BatchIndex, BatchIndexType};
let batch_index = BatchIndex::Usize(4);
let regex = batch_index.file_pattern();
Using Regex to Match Batch Filenames
assert!(regex.is_match("batch_input_4.jsonl"));
assert!(!regex.is_match("batch_input_invalid.jsonl"));
Converting Between BatchIndex and BatchIndexType
let index_type = BatchIndexType::from(&batch_index);
Error Handling
The crate defines errors for UUID parsing, ensuring proper validation and handling of batch index values.
License
This crate is licensed under the MIT License. See LICENSE for details.
Dependencies
~28–52MB
~719K SLoC