Trait text_splitter::ChunkCapacity
source · pub trait ChunkCapacity {
// Required method
fn end(&self) -> usize;
// Provided methods
fn start(&self) -> Option<usize> { ... }
fn fits(&self, chunk_size: usize) -> Ordering { ... }
}Expand description
Describes the largest valid chunk size(s) that can be generated.
An end size is required, which is the maximum possible chunk size that
can be generated.
A start size is optional. By specifying start and end it means a
range of sizes will be considered valid. Once a chunk has reached a length
that falls between start and end it will be returned.
It is always possible that a chunk may be returned that is less than the
start value, as adding the next piece of text may have made it larger
than the end capacity.