pub struct CodeChunker { /* private fields */ }
Expand description
Splits code into semantic chunks for selective demotion using tree-sitter AST parsing
Implementations§
Source§impl CodeChunker
impl CodeChunker
pub fn new(ast_parser: Rc<RefCell<AstParser>>) -> Self
pub fn detect_language(&mut self, file_path: &str) -> Option<AstLanguage>
pub fn chunk_content( &mut self, content: &str, file_path: &str, ) -> Result<Vec<ChunkInfo>>
pub fn select_chunks_by_budget( &self, chunks: &[ChunkInfo], token_budget: usize, ) -> Vec<usize>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CodeChunker
impl !RefUnwindSafe for CodeChunker
impl !Send for CodeChunker
impl !Sync for CodeChunker
impl Unpin for CodeChunker
impl !UnwindSafe for CodeChunker
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