Expand description
Batch command — process multiple 3MF/STL/OBJ files with a single invocation.
This module implements the core batch engine for the 3mf batch command.
The batch pipeline:
- Expand glob patterns, walk directories, deduplicate inputs
- Detect file type from magic bytes (Zip3mf, Stl, Obj, Unknown)
- Filter files by requested operations (e.g. validate only applies to 3MF)
- Process files sequentially (jobs=1) or in parallel via rayon (jobs>1)
- Accumulate per-file results — never abort on single failure
- Emit text progress [N/M] or JSON Lines output per file
- Optionally print summary (totals + failed list)
SAFETY RULE: This module NEVER calls crate::commands::validate / stats / list. Those functions print directly to stdout and call std::process::exit(). Instead, we call lib3mf-core APIs directly:
- model.validate(level) → ValidationReport
- model.compute_stats(archiver) → ModelStats
- archiver.list_entries() →
Vec<String>
Structs§
- Batch
Config - Top-level configuration for a batch run (passed to
run()). - Batch
Ops - Set of operations to perform in a batch run.
- File
Error - Error record for a single failed operation on a file.
- File
Result - Result of processing one file.
Enums§
- Detected
File Type - Detected type of a file based on magic bytes / extension.
- Error
Category - Error category for per-operation failures.
Functions§
- detect_
file_ type - Reads magic bytes to classify a file’s type.
- discover_
files - Expands glob patterns, walks directories recursively (if recursive=true), and collects individual file paths. Deduplicates by canonical path.
- process_
file - Processes a single file, running all requested operations.
- run
- Entry point for the batch command.