ConfigBuilder

Struct ConfigBuilder 

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

Builder for creating a Config.

Implementations§

Source§

impl ConfigBuilder

Source

pub fn root_dir(self, path: impl Into<PathBuf>) -> Self

Sets the root directory to scan.

Source

pub fn output_dir(self, path: impl Into<PathBuf>) -> Self

Sets the output directory for generated files.

Source

pub fn output_pattern(self, pattern: impl Into<String>) -> Self

Sets the output filename pattern.

Pattern must contain {index} and {ext} placeholders.

Source

pub fn format(self, format: OutputFormat) -> Self

Sets the output format.

Source

pub fn max_tokens(self, tokens: usize) -> Self

Sets the maximum tokens per chunk.

Source

pub fn overlap_tokens(self, tokens: usize) -> Self

Sets the overlap tokens between chunks.

Source

pub fn chunk_safety_margin(self, margin: usize) -> Self

Sets the chunk safety margin.

Source

pub fn tokenizer(self, kind: TokenizerKind) -> Self

Sets the tokenizer implementation.

Source

pub fn prefer_line_boundaries(self, enabled: bool) -> Self

Enables or disables line boundary preference.

Source

pub fn dry_run(self, enabled: bool) -> Self

Enables dry run mode (no file writes).

Source

pub fn include_binary_files(self, enabled: bool) -> Self

Enables or disables binary file inclusion.

Source

pub fn backup_existing(self, enabled: bool) -> Self

Enables or disables backup creation.

Source

pub fn filter_config(self, config: FilterConfig) -> Self

Sets the code filtering configuration.

Source

pub fn file_filter_config(self, config: FileFilterConfig) -> Self

Sets the code filtering configuration.

Source

pub fn preset(self, preset: PresetKind) -> Self

Sets the LLM preset.

Source

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.

Source

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.

Source

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");
Source

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");
Source

pub fn build(self) -> Result<Config>

Builds the configuration.

§Errors

Returns an error if validation fails.

Trait Implementations§

Source§

impl Debug for ConfigBuilder

Source§

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

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

impl Default for ConfigBuilder

Source§

fn default() -> ConfigBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

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
§

impl<T, U> Into<U> for T
where U: From<T>,

§

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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