pub struct TestConfigBuilder { /* private fields */ }
Expand description
Fluent builder for creating test configurations.
This builder provides a convenient way to create configurations for testing with specific settings, using method chaining for clarity.
§Examples
use subx_cli::config::TestConfigBuilder;
let config = TestConfigBuilder::new()
.with_ai_provider("openai")
.with_ai_model("gpt-4.1")
.with_vad_enabled(true)
.build_config();
Implementations§
Source§impl TestConfigBuilder
impl TestConfigBuilder
Sourcepub fn with_ai_provider(self, provider: &str) -> Self
pub fn with_ai_provider(self, provider: &str) -> Self
Sourcepub fn with_ai_model(self, model: &str) -> Self
pub fn with_ai_model(self, model: &str) -> Self
Sourcepub fn with_ai_api_key(self, api_key: &str) -> Self
pub fn with_ai_api_key(self, api_key: &str) -> Self
Sourcepub fn with_ai_base_url(self, base_url: &str) -> Self
pub fn with_ai_base_url(self, base_url: &str) -> Self
Sourcepub fn with_max_sample_length(self, length: usize) -> Self
pub fn with_max_sample_length(self, length: usize) -> Self
Set the maximum sample length for AI requests.
§Arguments
length
- Maximum sample length in characters
Sourcepub fn with_ai_temperature(self, temperature: f32) -> Self
pub fn with_ai_temperature(self, temperature: f32) -> Self
Sourcepub fn with_ai_max_tokens(self, max_tokens: u32) -> Self
pub fn with_ai_max_tokens(self, max_tokens: u32) -> Self
Sourcepub fn with_ai_retry(self, attempts: u32, delay_ms: u64) -> Self
pub fn with_ai_retry(self, attempts: u32, delay_ms: u64) -> Self
Set the AI retry parameters.
§Arguments
attempts
- Number of retry attemptsdelay_ms
- Delay between retries in milliseconds
Sourcepub fn with_ai_request_timeout(self, timeout_seconds: u64) -> Self
pub fn with_ai_request_timeout(self, timeout_seconds: u64) -> Self
Sourcepub fn with_sync_method(self, method: &str) -> Self
pub fn with_sync_method(self, method: &str) -> Self
Set the synchronization method.
§Arguments
method
- The sync method to use (“vad”, “auto”, “manual”)
Sourcepub fn with_vad_enabled(self, enabled: bool) -> Self
pub fn with_vad_enabled(self, enabled: bool) -> Self
Sourcepub fn with_vad_sensitivity(self, sensitivity: f32) -> Self
pub fn with_vad_sensitivity(self, sensitivity: f32) -> Self
Sourcepub fn with_default_output_format(self, format: &str) -> Self
pub fn with_default_output_format(self, format: &str) -> Self
Sourcepub fn with_preserve_styling(self, preserve: bool) -> Self
pub fn with_preserve_styling(self, preserve: bool) -> Self
Sourcepub fn with_default_encoding(self, encoding: &str) -> Self
pub fn with_default_encoding(self, encoding: &str) -> Self
Sourcepub fn with_encoding_detection_confidence(self, confidence: f32) -> Self
pub fn with_encoding_detection_confidence(self, confidence: f32) -> Self
Set the encoding detection confidence threshold.
§Arguments
confidence
- Confidence threshold (0.0-1.0)
Sourcepub fn with_backup_enabled(self, enabled: bool) -> Self
pub fn with_backup_enabled(self, enabled: bool) -> Self
Sourcepub fn with_max_concurrent_jobs(self, jobs: usize) -> Self
pub fn with_max_concurrent_jobs(self, jobs: usize) -> Self
Sourcepub fn with_task_timeout(self, timeout_seconds: u64) -> Self
pub fn with_task_timeout(self, timeout_seconds: u64) -> Self
Sourcepub fn with_progress_bar(self, enabled: bool) -> Self
pub fn with_progress_bar(self, enabled: bool) -> Self
Sourcepub fn with_worker_idle_timeout(self, timeout_seconds: u64) -> Self
pub fn with_worker_idle_timeout(self, timeout_seconds: u64) -> Self
Sourcepub fn with_task_queue_size(self, size: usize) -> Self
pub fn with_task_queue_size(self, size: usize) -> Self
Sourcepub fn with_task_priorities(self, enabled: bool) -> Self
pub fn with_task_priorities(self, enabled: bool) -> Self
Sourcepub fn with_auto_balance_workers(self, enabled: bool) -> Self
pub fn with_auto_balance_workers(self, enabled: bool) -> Self
Sourcepub fn with_queue_overflow_strategy(self, strategy: OverflowStrategy) -> Self
pub fn with_queue_overflow_strategy(self, strategy: OverflowStrategy) -> Self
Sourcepub fn with_parallel_settings(
self,
max_workers: usize,
queue_size: usize,
) -> Self
pub fn with_parallel_settings( self, max_workers: usize, queue_size: usize, ) -> Self
Set the number of parallel workers and queue size, used for integration testing.
Sourcepub fn build_service(self) -> TestConfigService
pub fn build_service(self) -> TestConfigService
Build a test configuration service with the configured settings.
Sourcepub fn build_config(self) -> Config
pub fn build_config(self) -> Config
Build a configuration object with the configured settings.
Sourcepub fn config_mut(&mut self) -> &mut Config
pub fn config_mut(&mut self) -> &mut Config
Get a mutable reference to the current configuration being built.
Sourcepub fn with_mock_ai_server(self, mock_url: &str) -> Self
pub fn with_mock_ai_server(self, mock_url: &str) -> Self
Configure AI base URL for mock server integration testing.
Sets up the configuration to use a mock AI server for testing purposes. This is primarily used in integration tests to avoid making real API calls.
§Arguments
mock_url
: The URL of the mock server to use for AI API calls
§Examples
use subx_cli::config::TestConfigBuilder;
let config = TestConfigBuilder::new()
.with_mock_ai_server("http://localhost:3000")
.build_config();