| Crates.io | tree-sitter-iter |
| lib.rs | tree-sitter-iter |
| version | 0.0.3 |
| created_at | 2025-10-19 19:47:34.4572+00 |
| updated_at | 2025-12-18 22:38:17.453509+00 |
| description | A very simple pre-order iterator for tree-sitter CSTs |
| homepage | https://docs.zizmor.sh |
| repository | |
| max_upload_size | |
| id | 1890881 |
| size | 12,213 |
A very simple pre-order iterator for tree-sitter CSTs.
This library is part of zizmor.
Given a tree_sitter::Tree, you can create a TreeIter to iterate
over its nodes in pre-order:
use tree_sitter_iter::TreeIter;
let tree: tree_sitter::Tree = parse(); // Your parsing logic here.
for node in TreeIter::new(&tree) {
println!("Node kind: {}", node.kind());
}
TreeIter implements the standard Iterator trait, meaning that
you can use any of the normal iterator combinators. For example, to
filter only to nodes of a specific kind:
for node in TreeIter::new(&tree).filter(|n| n.kind() == "call") {
// Do something with each "call" node.
}
tree-sitter-iter's space and time performance is equivalent to a
walk of the tree using the TreeCursor APIs. In other words, it's
exactly the same as using a TreeCursor manually, but with a more ergonomic
iterator interface.
See the documentation for more details.