Trait countroo::Analyzable

source ·
pub trait Analyzable {
    // Required methods
    fn get_project_base(&self) -> String;
    fn is_code_file(&self, path: &str) -> bool;
    fn get_manifest(&self) -> Result<Manifest, LocCounterError>;
    fn count_code_files(
        &self,
        project_path: &str
    ) -> Result<usize, LocCounterError>;
    fn count_crates(&self) -> Result<usize, LocCounterError>;
    fn get_project_name(&self) -> Result<Option<String>, LocCounterError>;
    fn get_rust_version() -> Option<String>;
    fn get_rust_edition(&self) -> Option<String>;
    fn count_rust_modules(project_path: &str) -> Result<usize, LocCounterError>;
    fn analyze_code_base(&mut self);
}
Expand description

Analyzable 🔍 - Unearthing the Secrets of Your Rust Project!

For Rustaceans who love to dig deeper into their projects, Analyzable is the treasure map 🗺️ that leads to insights galore. Implement this trait to analyze your Rust project’s structure, dependencies, and more, uncovering information that helps you navigate the coding journey ahead. 🚢

§Capabilities

  • Get Project Base: Finds the base directory of your project. 🏠
  • Is Code File: Determines if a given path points to a source code file. 📄✅
  • Get Manifest: Retrieves the Cargo.toml manifest of your project. 📦
  • Count Code Files: Tallies the number of source code files in your project. 🗂️
  • Count Crates: Counts the crates on which your project depends. 🛠️
  • Get Project Name: Extracts the name of your project from its manifest. 📛
  • Get Rust Version: Determines the version of Rust used by your project. 🦀
  • Get Rust Edition: Identifies the Rust edition your project adheres to. 📚
  • Count Rust Modules: Counts the Rust modules within your project. 🧩
  • Analyze Code Base: Performs a comprehensive analysis of your project’s code base. 🕵️‍♂️

§Example Implementation

use countroo::prelude::*;
struct MyProjectAnalyzer {
    // Project-specific fields
}

impl Analyzable for MyProjectAnalyzer {
    fn get_project_base(&self) -> String {
        todo!()
    }

    fn is_code_file(&self, path: &str) -> bool {
        todo!()
    }

    fn get_manifest(&self) -> Result<Manifest, LocCounterError> {
        todo!()
    }

    fn count_code_files(&self, project_path: &str) -> Result<usize, LocCounterError> {
        todo!()
    }

    fn count_crates(&self) -> Result<usize, LocCounterError> {
        todo!()
    }

    fn get_project_name(&self) -> Result<Option<String>, LocCounterError> {
        todo!()
    }

    fn get_rust_version() -> Option<String> {
        todo!()
    }

    fn get_rust_edition(&self) -> Option<String> {
        todo!()
    }

    fn count_rust_modules(project_path: &str) -> Result<usize, LocCounterError> {
        todo!()
    }

    fn analyze_code_base(&mut self) {
        todo!()
    }
    // Implement the rest of the methods as per your project's requirements...
}

Whether you’re looking to optimize your project structure, curious about your dependency graph, or just want to know how many lines of Rust you’ve written, Analyzable is your key to unlocking those insights. Let the analysis begin! 🔎🚀

Required Methods§

Object Safety§

This trait is not object safe.

Implementors§