Struct Config

Source
pub struct Config {
    pub repo_path: PathBuf,
    pub max_tokens: usize,
    pub output_file: String,
    pub include_hidden: bool,
    pub include_deps: bool,
}
Expand description

Configuration structure for the AI Context Generator.

This structure holds all the configuration options that control how the context generation process behaves, including input/output paths, token limits, and scanning options.

§Examples

use ai_context_gen::Config;
use std::path::PathBuf;

// Create a default configuration
let config = Config::default();

// Create a custom configuration
let custom_config = Config {
    repo_path: PathBuf::from("./my-project"),
    max_tokens: 100000,
    output_file: "custom_context.md".to_string(),
    include_hidden: true,
    include_deps: false,
};

Fields§

§repo_path: PathBuf

Path to the repository to analyze.

This should point to the root directory of the project you want to analyze. The scanner will recursively process all supported files within this directory.

§max_tokens: usize

Maximum number of tokens to include in the generated context.

This limit helps ensure the generated context fits within LLM token limits. When the limit is reached, lower priority content will be truncated. Uses GPT-4 tokenizer for accurate counting.

§output_file: String

Output file path for the generated context.

The generated markdown context will be written to this file. If the file already exists, it will be overwritten.

§include_hidden: bool

Whether to include hidden files and directories in the analysis.

When true, files and directories starting with . will be included in the scan (except for those in IGNORED_DIRS).

§include_deps: bool

Whether to include external dependency analysis.

When true, the generator will attempt to analyze and include information about external dependencies from Cargo.toml.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Creates a default configuration with sensible defaults.

§Default Values
  • repo_path: Current directory (.)
  • max_tokens: 50,000 tokens
  • output_file: "repo_context.md"
  • include_hidden: false
  • include_deps: false
§Examples
use ai_context_gen::Config;

let config = Config::default();
assert_eq!(config.max_tokens, 50000);
assert_eq!(config.output_file, "repo_context.md");
Source§

impl<'de> Deserialize<'de> for Config

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Config

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,