code-chunk 0.1.0

Split source code into RAG-friendly chunks that respect function and class boundaries. Brace and indent-aware, language-agnostic heuristics. Zero deps.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# code-chunk

[![crates.io](https://img.shields.io/crates/v/code-chunk.svg)](https://crates.io/crates/code-chunk)

Brace-aware code chunker for RAG. Splits source on function/class
boundaries via brace-depth tracking — no language parser needed.

```rust
use code_chunk::chunk;
let src = "fn a() { 1 }\nfn b() { 2 }";
let chunks = chunk(src, 200);
```

Soft cap: oversize functions stay whole rather than splitting mid-body.
Zero deps. MIT or Apache-2.0.