pub struct ChunkMetadata {
pub source: Option<String>,
pub content_type: Option<String>,
pub chunk_size: usize,
pub overlap: usize,
pub preserve_lines: bool,
pub preserve_sentences: bool,
pub max_chunks: usize,
}Expand description
Metadata provided to chunkers for context-aware processing.
This allows callers to customize chunking behavior without modifying the chunker itself.
Fields§
§source: Option<String>Source file path (for content-type detection).
content_type: Option<String>File MIME type or extension (e.g., “md”, “json”, “py”).
chunk_size: usizeTarget chunk size in characters.
overlap: usizeOverlap between consecutive chunks.
preserve_lines: boolWhether to preserve line boundaries.
preserve_sentences: boolWhether to preserve sentence boundaries.
max_chunks: usizeMaximum chunks to produce (0 = unlimited).
Implementations§
Source§impl ChunkMetadata
impl ChunkMetadata
Sourcepub fn with_size(chunk_size: usize) -> Self
pub fn with_size(chunk_size: usize) -> Self
Creates metadata with custom chunk size and no overlap.
Sourcepub fn with_size_and_overlap(chunk_size: usize, overlap: usize) -> Self
pub fn with_size_and_overlap(chunk_size: usize, overlap: usize) -> Self
Creates metadata with custom size and overlap.
Sourcepub fn content_type(self, content_type: &str) -> Self
pub fn content_type(self, content_type: &str) -> Self
Sets the content type.
Sourcepub const fn preserve_lines(self, preserve: bool) -> Self
pub const fn preserve_lines(self, preserve: bool) -> Self
Sets whether to preserve line boundaries.
Sourcepub const fn preserve_sentences(self, preserve: bool) -> Self
pub const fn preserve_sentences(self, preserve: bool) -> Self
Sets whether to preserve sentence boundaries.
Sourcepub const fn max_chunks(self, max: usize) -> Self
pub const fn max_chunks(self, max: usize) -> Self
Sets maximum chunks.
Trait Implementations§
Source§impl Clone for ChunkMetadata
impl Clone for ChunkMetadata
Source§fn clone(&self) -> ChunkMetadata
fn clone(&self) -> ChunkMetadata
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ChunkMetadata
impl Debug for ChunkMetadata
Source§impl Default for ChunkMetadata
impl Default for ChunkMetadata
Source§fn default() -> ChunkMetadata
fn default() -> ChunkMetadata
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ChunkMetadata
impl RefUnwindSafe for ChunkMetadata
impl Send for ChunkMetadata
impl Sync for ChunkMetadata
impl Unpin for ChunkMetadata
impl UnwindSafe for ChunkMetadata
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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