CodebaseParser

Struct CodebaseParser 

Source
pub struct CodebaseParser { /* private fields */ }
Expand description

High-level codebase parser that combines directory walking with Rust parsing.

This is the main entry point for parsing a Rust codebase. It walks through directories, discovers Rust source files, and parses them to extract structured code information.

Implementations§

Source§

impl CodebaseParser

Source

pub fn new() -> Self

Creates a new CodebaseParser with default settings.

Source

pub fn walker_config(self, config: WalkerConfig) -> Self

Sets the walker configuration.

Source

pub fn include_private(self, include: bool) -> Self

Sets whether to include private items.

Source

pub fn continue_on_error(self, continue_on_error: bool) -> Self

Sets whether to continue parsing when a file has syntax errors.

Source

pub fn parse_directory<P: AsRef<Path>>(&self, path: P) -> ParseResult<CodeBase>

Parses all Rust files in the given directory.

§Arguments
  • path - Path to the directory to parse.
§Returns

A CodeBase containing all parsed elements from the directory.

§Errors

Returns an error if the directory cannot be walked or if parsing fails (when continue_on_error is false).

Source

pub fn parse_file<P: AsRef<Path>>(&self, path: P) -> ParseResult<CodeBase>

Parses a single Rust source file.

§Arguments
  • path - Path to the Rust source file.
§Returns

A CodeBase containing all parsed elements from the file.

Source

pub fn parse_source( &self, source: &str, file_path: &str, ) -> ParseResult<CodeBase>

Parses Rust source code from a string.

§Arguments
  • source - The Rust source code as a string.
  • file_path - The path to use for error messages.
§Returns

A CodeBase containing all parsed elements.

Trait Implementations§

Source§

impl Default for CodebaseParser

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.