pub struct ParsedFile {
pub language: Language,
pub source: String,
/* private fields */
}Expand description
A parsed file with its AST.
Fields§
§language: Language§source: StringImplementations§
Source§impl ParsedFile
impl ParsedFile
Sourcepub fn parse(source: impl Into<String>, language: Language) -> Option<Self>
pub fn parse(source: impl Into<String>, language: Language) -> Option<Self>
Parse a file’s contents.
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