pub struct ConfigBuilder { /* private fields */ }Expand description
Builder for creating a Config.
Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
Sourcepub fn output_dir(self, path: impl Into<PathBuf>) -> Self
pub fn output_dir(self, path: impl Into<PathBuf>) -> Self
Sets the output directory for generated files.
Sourcepub fn output_pattern(self, pattern: impl Into<String>) -> Self
pub fn output_pattern(self, pattern: impl Into<String>) -> Self
Sets the output filename pattern.
Pattern must contain {index} and {ext} placeholders.
Sourcepub fn format(self, format: OutputFormat) -> Self
pub fn format(self, format: OutputFormat) -> Self
Sets the output format.
Sourcepub fn max_tokens(self, tokens: usize) -> Self
pub fn max_tokens(self, tokens: usize) -> Self
Sets the maximum tokens per chunk.
Sourcepub fn overlap_tokens(self, tokens: usize) -> Self
pub fn overlap_tokens(self, tokens: usize) -> Self
Sets the overlap tokens between chunks.
Sourcepub fn chunk_safety_margin(self, margin: usize) -> Self
pub fn chunk_safety_margin(self, margin: usize) -> Self
Sets the chunk safety margin.
Sourcepub fn tokenizer(self, kind: TokenizerKind) -> Self
pub fn tokenizer(self, kind: TokenizerKind) -> Self
Sets the tokenizer implementation.
Sourcepub fn prefer_line_boundaries(self, enabled: bool) -> Self
pub fn prefer_line_boundaries(self, enabled: bool) -> Self
Enables or disables line boundary preference.
Sourcepub fn include_binary_files(self, enabled: bool) -> Self
pub fn include_binary_files(self, enabled: bool) -> Self
Enables or disables binary file inclusion.
Sourcepub fn backup_existing(self, enabled: bool) -> Self
pub fn backup_existing(self, enabled: bool) -> Self
Enables or disables backup creation.
Sourcepub fn filter_config(self, config: FilterConfig) -> Self
pub fn filter_config(self, config: FilterConfig) -> Self
Sets the code filtering configuration.
Sourcepub fn file_filter_config(self, config: FileFilterConfig) -> Self
pub fn file_filter_config(self, config: FileFilterConfig) -> Self
Sets the code filtering configuration.
Sourcepub fn preset(self, preset: PresetKind) -> Self
pub fn preset(self, preset: PresetKind) -> Self
Sets the LLM preset.
Sourcepub fn template_path(self, path: impl Into<PathBuf>) -> Self
pub fn template_path(self, path: impl Into<PathBuf>) -> Self
Sets the path to an external template file.
When provided, this template will be used instead of the built-in template for the selected format. The template file must exist and contain valid Tera syntax.
Sourcepub fn custom_format_name(self, name: impl Into<String>) -> Self
pub fn custom_format_name(self, name: impl Into<String>) -> Self
Sets the custom format name.
Required when using OutputFormat::Custom. This name will be used
internally to identify the custom template.
Sourcepub fn custom_extension(self, ext: impl Into<String>) -> Self
pub fn custom_extension(self, ext: impl Into<String>) -> Self
Sets the custom file extension.
Required when using OutputFormat::Custom. This extension will be used
for output files (without the leading dot).
§Examples
use llm_utl::{Config, OutputFormat};
let config = Config::builder()
.root_dir(".")
.format(OutputFormat::Custom)
.custom_extension("txt") // Files will be .txt
.custom_format_name("my_format")
.template_path("./template.tera")
.build()
.expect("valid config");Sourcepub fn custom_data(self, data: HashMap<String, Value>) -> Self
pub fn custom_data(self, data: HashMap<String, Value>) -> Self
Sets custom data to be passed to templates.
This data will be available in templates under the ctx.custom namespace.
§Examples
use llm_utl::Config;
use std::collections::HashMap;
use serde_json::Value;
let mut custom_data = HashMap::new();
custom_data.insert("version".to_string(), Value::String("1.0.0".to_string()));
custom_data.insert("author".to_string(), Value::String("John Doe".to_string()));
let config = Config::builder()
.root_dir(".")
.custom_data(custom_data)
.build()
.expect("valid config");