pub trait Splitter: Send + Sync {
// Required methods
fn next_record_start(&self, bytes: &[u8], from: usize) -> Option<usize>;
fn estimate_bytes_per_row(&self, sample: &[u8]) -> usize;
// Provided methods
fn skip_regions(&self) -> Option<&dyn SkipRegionFinder> { ... }
fn find_split_points(&self, bytes: &[u8], max_chunks: usize) -> Vec<usize> { ... }
}Expand description
Format-specific splitter: decides where it is safe to divide an input byte stream into independent chunks.
The only required method is next_record_start; adapters provide the
record boundary logic, and the engine handles chunk planning, skip-region
rejection, and deduplication.
Required Methods§
Sourcefn next_record_start(&self, bytes: &[u8], from: usize) -> Option<usize>
fn next_record_start(&self, bytes: &[u8], from: usize) -> Option<usize>
Return the next record boundary at or after from. Must return a
position where a record starts, or None if no more records exist.
Sourcefn estimate_bytes_per_row(&self, sample: &[u8]) -> usize
fn estimate_bytes_per_row(&self, sample: &[u8]) -> usize
Estimate the average bytes per record from a sample of the input.
Provided Methods§
Sourcefn skip_regions(&self) -> Option<&dyn SkipRegionFinder>
fn skip_regions(&self) -> Option<&dyn SkipRegionFinder>
Optional: byte ranges where a candidate boundary must be rejected.
See in_skip_region.
Sourcefn find_split_points(&self, bytes: &[u8], max_chunks: usize) -> Vec<usize>
fn find_split_points(&self, bytes: &[u8], max_chunks: usize) -> Vec<usize>
Find split points. Do not override without a measured reason.
Default implementation:
- Nominal offsets at
bytes.len() * i / nfori in 1..n. par_iterover nominals (rayon), each callingnext_record_start.- Reject candidates inside skip regions via
in_skip_region. - Dedup, sort, prepend 0.
- Apply chunk floor via
plan_chunk_count.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".