pub struct TestConfigService { /* private fields */ }Expand description
Test configuration service implementation.
This service provides a fixed configuration for testing purposes, ensuring complete isolation between tests and predictable behavior. It does not load from external sources or cache.
Implementations§
Source§impl TestConfigService
impl TestConfigService
Sourcepub fn new(config: Config) -> Self
pub fn new(config: Config) -> Self
Create a new test configuration service with the provided configuration.
§Arguments
config- The fixed configuration to use
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a test configuration service with default settings.
This is useful for tests that don’t need specific configuration values.
Sourcepub fn with_ai_settings(provider: &str, model: &str) -> Self
pub fn with_ai_settings(provider: &str, model: &str) -> Self
Create a test configuration service with specific AI settings.
§Arguments
provider- AI provider namemodel- AI model name
Sourcepub fn with_ai_settings_and_key(
provider: &str,
model: &str,
api_key: &str,
) -> Self
pub fn with_ai_settings_and_key( provider: &str, model: &str, api_key: &str, ) -> Self
Create a test configuration service with specific AI settings including API key.
§Arguments
provider- AI provider namemodel- AI model nameapi_key- API key for the provider
Sourcepub fn with_sync_settings(correlation_threshold: f32, max_offset: f32) -> Self
pub fn with_sync_settings(correlation_threshold: f32, max_offset: f32) -> Self
Create a test configuration service with specific sync settings.
§Arguments
correlation_threshold- Correlation threshold for synchronizationmax_offset- Maximum time offset in seconds
Sourcepub fn with_parallel_settings(max_workers: usize, queue_size: usize) -> Self
pub fn with_parallel_settings(max_workers: usize, queue_size: usize) -> Self
Create a test configuration service with specific parallel processing settings.
§Arguments
max_workers- Maximum number of parallel workersqueue_size- Task queue size
Sourcepub fn config(&self) -> &Config
pub fn config(&self) -> &Config
Get the underlying configuration.
This is useful for tests that need direct access to the configuration object.
Sourcepub fn config_mut(&mut self) -> &mut Config
pub fn config_mut(&mut self) -> &mut Config
Get a mutable reference to the underlying configuration.
This allows tests to modify the configuration after creation.
Trait Implementations§
Source§impl ConfigService for TestConfigService
impl ConfigService for TestConfigService
Source§fn save_config(&self) -> Result<()>
fn save_config(&self) -> Result<()>
Source§fn save_config_to_file(&self, _path: &Path) -> Result<()>
fn save_config_to_file(&self, _path: &Path) -> Result<()>
Source§fn get_config_file_path(&self) -> Result<PathBuf>
fn get_config_file_path(&self) -> Result<PathBuf>
Auto Trait Implementations§
impl Freeze for TestConfigService
impl RefUnwindSafe for TestConfigService
impl Send for TestConfigService
impl Sync for TestConfigService
impl Unpin for TestConfigService
impl UnwindSafe for TestConfigService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.