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: &ChunkCapacity) -> Self
pub fn from_size(size: usize, capacity: &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: &ChunkCapacity
) -> Self
pub fn from_offsets( offsets: impl Iterator<Item = Range<usize>>, capacity: &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 Freeze for ChunkSize
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more