Struct text_splitter::ChunkSize
source · pub struct ChunkSize { /* private fields */ }Expand description
Result returned from a ChunkSizer. Includes the size of the chunk, in units
determined by the sizer, as well as the max byte offset of the text that
would fit within the given ChunkCapacity.
Implementations§
source§impl ChunkSize
impl ChunkSize
sourcepub fn from_size(size: usize, capacity: &impl ChunkCapacity) -> Self
pub fn from_size(size: usize, capacity: &impl ChunkCapacity) -> Self
Generate a chunk size from a given size. Will not be able to compute the max byte offset that fits within the capacity.
sourcepub fn from_offsets(
offsets: impl Iterator<Item = Range<usize>>,
capacity: &impl ChunkCapacity
) -> Self
pub fn from_offsets( offsets: impl Iterator<Item = Range<usize>>, capacity: &impl ChunkCapacity ) -> Self
Generate a chunk size from an iterator of byte ranges for each encoded element in the chunk.
Trait Implementations§
source§impl PartialEq for ChunkSize
impl PartialEq for ChunkSize
impl Copy for ChunkSize
impl StructuralPartialEq for ChunkSize
Auto Trait Implementations§
impl RefUnwindSafe for ChunkSize
impl Send for ChunkSize
impl Sync for ChunkSize
impl Unpin for ChunkSize
impl UnwindSafe for ChunkSize
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more