Struct ProjectIndexer

Source
pub struct ProjectIndexer {
    pub config: IndexerConfig,
}
Expand description

Main project indexer functionality

This struct implements the core indexing logic for scanning and analyzing project directories. It handles:

  • Directory traversal and filtering
  • Git repository status detection
  • Project categorization
  • Tag generation using Ollama

§Examples

use projets_indexer::{IndexerConfig, ProjectIndexer};
use std::path::PathBuf;

let config = IndexerConfig::new(
    PathBuf::from("/path/to/projects"),
    PathBuf::from("projects_index.json"),
    true,
);

let indexer = ProjectIndexer::new(config)?;
indexer.index_projects().await?;

Fields§

§config: IndexerConfig

Configuration for the indexer

Contains all the settings and options needed to run the indexer, including paths and feature flags.

Implementations§

Source§

impl ProjectIndexer

Source

pub fn new(config: IndexerConfig) -> Result<Self>

Create a new project indexer with the given configuration

This function initializes a new ProjectIndexer with the provided configuration. If Ollama is enabled, it will also initialize the Ollama client for tag generation.

§Arguments
  • config - The configuration to use for the indexer
§Returns

A Result<Self> containing the initialized ProjectIndexer or an error if initialization fails.

§Examples
use projets_indexer::{IndexerConfig, ProjectIndexer};
use std::path::PathBuf;

let config = IndexerConfig::new(
    PathBuf::from("/path/to/projects"),
    PathBuf::from("projects_index.json"),
    true,
);

let indexer = ProjectIndexer::new(config)?;
Source

pub async fn index_projects<F>( &self, progress_callback: F, ) -> Result<Vec<Project>>
where F: FnMut(&str),

Index all projects in the configured directory

This is the main function that performs the project indexing process. It:

  1. Traverses the configured directory
  2. Identifies and processes project directories
  3. Generates metadata for each project
  4. Saves the results to the configured output file
§Returns

A Result<Vec<Project>> containing the list of indexed projects or an error if the indexing process fails.

§Examples
use projets_indexer::{IndexerConfig, ProjectIndexer};
use std::path::PathBuf;

let config = IndexerConfig::new(
    PathBuf::from("/path/to/projects"),
    PathBuf::from("projects_index.json"),
    true,
);

let indexer = ProjectIndexer::new(config)?;
indexer.index_projects().await?;

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,