Struct RepositoryScanner

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

Repository scanner that processes project files and structure.

The scanner walks through the repository directory, identifies relevant files, extracts their content, and gathers project metadata.

§Examples

use ai_context_gen::{Config, RepositoryScanner};
use std::path::PathBuf;

let config = Config {
    repo_path: PathBuf::from("."),
    max_tokens: 50000,
    output_file: "context.md".to_string(),
    include_hidden: false,
    include_deps: true,
};

let scanner = RepositoryScanner::new(config);
let scan_result = scanner.scan().await?;

println!("Found {} files", scan_result.files.len());

Implementations§

Source§

impl RepositoryScanner

Source

pub fn new(config: Config) -> Self

Creates a new repository scanner with the given configuration.

§Arguments
  • config - Configuration specifying scanning behavior and output options
§Examples
use ai_context_gen::{Config, RepositoryScanner};

let config = Config::default();
let scanner = RepositoryScanner::new(config);
Source

pub async fn scan(&self) -> Result<ScanResult>

Performs a complete scan of the repository.

This method walks through the repository directory structure, processes all supported files, extracts project metadata, and builds a comprehensive scan result.

§Returns

A ScanResult containing all discovered files, project structure, and metadata.

§Errors

Returns an error if:

  • The repository path doesn’t exist or isn’t accessible
  • File system errors occur during scanning
  • Files can’t be read or parsed
§Examples
use ai_context_gen::{Config, RepositoryScanner};

let config = Config::default();
let scanner = RepositoryScanner::new(config);
let result = scanner.scan().await?;

println!("Scanned {} files", result.files.len());
println!("Total size: {} bytes", result.project_structure.total_size);

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.