Skip to main content

ast_chunks

Function ast_chunks 

Source
pub fn ast_chunks<F, G>(
    path: &Utf8PathBuf,
    root: &Node<'_>,
    source: &str,
    language: Language,
    max_chunk_size: usize,
    kind_for_node: F,
    is_boundary: G,
) -> Result<Vec<Chunk>>
where F: Fn(&str) -> ChunkKind, G: Fn(&str) -> bool,
Expand description

Build AST-aware chunks around named definition nodes.

Named constructs (functions, classes, structs, etc.) become their own chunks when they fit within max_chunk_size. Text between constructs becomes TopLevel chunks. Any node exceeding max_chunk_size is split into Fallback character-based chunks.