pub struct ConfigManager { /* private fields */ }Expand description
Configuration manager for loading, saving, and validating configurations
Implementations§
Source§impl ConfigManager
impl ConfigManager
Sourcepub fn load_from_file<P: AsRef<Path>>(
&mut self,
path: P,
) -> Result<ModelSelectionConfig, ConfigError>
pub fn load_from_file<P: AsRef<Path>>( &mut self, path: P, ) -> Result<ModelSelectionConfig, ConfigError>
Load configuration from a file (supports JSON and YAML)
Sourcepub fn save_to_file<P: AsRef<Path>>(
&self,
config: &ModelSelectionConfig,
path: P,
) -> Result<(), ConfigError>
pub fn save_to_file<P: AsRef<Path>>( &self, config: &ModelSelectionConfig, path: P, ) -> Result<(), ConfigError>
Save configuration to a file
Sourcepub fn load_from_string(
&mut self,
content: &str,
format: &str,
) -> Result<ModelSelectionConfig, ConfigError>
pub fn load_from_string( &mut self, content: &str, format: &str, ) -> Result<ModelSelectionConfig, ConfigError>
Load configuration from a string
Sourcepub fn register_template(
&mut self,
name: String,
config: ModelSelectionConfig,
) -> Result<(), ConfigError>
pub fn register_template( &mut self, name: String, config: ModelSelectionConfig, ) -> Result<(), ConfigError>
Register a configuration template
Sourcepub fn get_template(&self, name: &str) -> Option<&ModelSelectionConfig>
pub fn get_template(&self, name: &str) -> Option<&ModelSelectionConfig>
Get a configuration template
Sourcepub fn from_template(
&self,
template_name: &str,
overrides: HashMap<String, Value>,
) -> Result<ModelSelectionConfig, ConfigError>
pub fn from_template( &self, template_name: &str, overrides: HashMap<String, Value>, ) -> Result<ModelSelectionConfig, ConfigError>
Create configuration from template with overrides
Sourcepub fn load_default_templates(&mut self)
pub fn load_default_templates(&mut self)
Get default configuration templates
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConfigManager
impl RefUnwindSafe for ConfigManager
impl Send for ConfigManager
impl Sync for ConfigManager
impl Unpin for ConfigManager
impl UnwindSafe for ConfigManager
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 more