pub struct ParsedFile {
pub language: Language,
pub source: Arc<str>,
/* private fields */
}Expand description
A parsed file with its tree-sitter AST and Heddle-owned syntax index.
Fields§
§language: Language§source: Arc<str>Implementations§
Source§impl ParsedFile
impl ParsedFile
Sourcepub fn parse(source: impl AsRef<str>, language: Language) -> Option<Self>
pub fn parse(source: impl AsRef<str>, language: Language) -> Option<Self>
Parse a file’s contents.
Sourcepub fn parse_owned(source: String, language: Language) -> Option<Self>
pub fn parse_owned(source: String, language: Language) -> Option<Self>
Parse already-owned contents without copying the source string.
Sourcepub fn content_hash(&self) -> ContentHash
pub fn content_hash(&self) -> ContentHash
Stable content identity for caches and sidecars.
Sourcepub fn syntax_index(&self) -> &SyntaxIndex
pub fn syntax_index(&self) -> &SyntaxIndex
Compact Heddle-owned syntax data derived from the AST.
Sourcepub fn functions(&self) -> impl Iterator<Item = FunctionRef<'_>> + '_
pub fn functions(&self) -> impl Iterator<Item = FunctionRef<'_>> + '_
Borrow indexed function definitions.
Sourcepub fn extract_functions(&self) -> Vec<FunctionDef>
pub fn extract_functions(&self) -> Vec<FunctionDef>
Extract function definitions from the file.
Sourcepub fn extract_imports(&self) -> Vec<Import>
pub fn extract_imports(&self) -> Vec<Import>
Extract imports from the file.
Sourcepub fn is_function_kind(kind: &str, language: Language) -> bool
pub fn is_function_kind(kind: &str, language: Language) -> bool
Check if a node kind string represents a function definition in the given language.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ParsedFile
impl RefUnwindSafe for ParsedFile
impl Send for ParsedFile
impl Sync for ParsedFile
impl Unpin for ParsedFile
impl UnsafeUnpin for ParsedFile
impl UnwindSafe for ParsedFile
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