pub struct StrDoc<L: LanguageExt> {
pub src: String,
pub lang: L,
pub tree: Tree,
}Expand description
Document type that combines source code with its parsed tree-sitter AST.
StrDoc represents a complete parsed document, holding both the original
source code and the tree-sitter AST. It supports incremental parsing,
meaning when edits are made to the source, only the affected parts of
the tree are re-parsed for better performance.
§Type Parameters
L: LanguageExt- The language implementation that provides tree-sitter integration
§Example
let doc = StrDoc::new("const x = 42;", JavaScript);
let root = doc.root_node();
println!("AST root: {}", root.kind());Fields§
§src: StringThe source code text
lang: LLanguage implementation for parsing and node operations
tree: TreeThe parsed tree-sitter AST
Implementations§
Trait Implementations§
Source§impl<L: LanguageExt> Doc for StrDoc<L>
impl<L: LanguageExt> Doc for StrDoc<L>
Auto Trait Implementations§
impl<L> Freeze for StrDoc<L>where
L: Freeze,
impl<L> RefUnwindSafe for StrDoc<L>where
L: RefUnwindSafe,
impl<L> Send for StrDoc<L>
impl<L> Sync for StrDoc<L>
impl<L> Unpin for StrDoc<L>where
L: Unpin,
impl<L> UnsafeUnpin for StrDoc<L>where
L: UnsafeUnpin,
impl<L> UnwindSafe for StrDoc<L>where
L: UnwindSafe,
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