pub struct FileConfigManager { /* private fields */ }Expand description
File-based configuration manager
Implementations§
Source§impl FileConfigManager
impl FileConfigManager
Sourcepub fn new() -> ConfigResult<Self>
pub fn new() -> ConfigResult<Self>
Create a new file-based configuration manager
Sourcepub fn with_paths(config_paths: ConfigPaths) -> Self
pub fn with_paths(config_paths: ConfigPaths) -> Self
Create with custom paths (mainly for testing)
Sourcepub fn config_file_path(&self) -> &Path
pub fn config_file_path(&self) -> &Path
Get the configuration file path
Sourcepub fn config_file_exists(&self) -> bool
pub fn config_file_exists(&self) -> bool
Check if configuration file exists
Sourcepub fn config_file_size(&self) -> ConfigResult<u64>
pub fn config_file_size(&self) -> ConfigResult<u64>
Get configuration file size in bytes
Sourcepub fn backup_config(&self) -> ConfigResult<PathBuf>
pub fn backup_config(&self) -> ConfigResult<PathBuf>
Create a backup of the current configuration file
Sourcepub fn restore_from_backup(&self, backup_path: &Path) -> ConfigResult<()>
pub fn restore_from_backup(&self, backup_path: &Path) -> ConfigResult<()>
Restore configuration from a backup file
Sourcepub fn export_to_file(&self, export_path: &Path) -> ConfigResult<()>
pub fn export_to_file(&self, export_path: &Path) -> ConfigResult<()>
Export configurations to a file
Sourcepub fn import_from_file(
&self,
import_path: &Path,
merge: bool,
) -> ConfigResult<Vec<String>>
pub fn import_from_file( &self, import_path: &Path, merge: bool, ) -> ConfigResult<Vec<String>>
Import configurations from a file
Sourcepub fn export_to_file_with_options(
&self,
export_path: &Path,
options: &ExportOptions,
) -> ConfigResult<()>
pub fn export_to_file_with_options( &self, export_path: &Path, options: &ExportOptions, ) -> ConfigResult<()>
Export configurations to a file with advanced options
Sourcepub fn import_from_file_with_options(
&self,
import_path: &Path,
options: &ImportOptions,
) -> ConfigResult<ImportResult>
pub fn import_from_file_with_options( &self, import_path: &Path, options: &ImportOptions, ) -> ConfigResult<ImportResult>
Import configurations from a file with advanced options
Sourcepub fn list_backups(&self) -> ConfigResult<Vec<PathBuf>>
pub fn list_backups(&self) -> ConfigResult<Vec<PathBuf>>
List all backup files in the configuration directory
Sourcepub fn cleanup_backups(&self, keep_count: usize) -> ConfigResult<usize>
pub fn cleanup_backups(&self, keep_count: usize) -> ConfigResult<usize>
Clean up old backup files, keeping only the most recent N backups
Sourcepub fn get_stats(&self) -> ConfigResult<ConfigStats>
pub fn get_stats(&self) -> ConfigResult<ConfigStats>
Get configuration statistics
Trait Implementations§
Source§impl ConfigManager for FileConfigManager
impl ConfigManager for FileConfigManager
fn load_configs(&self) -> ConfigResult<ConfigStore>
fn save_configs(&self, store: &ConfigStore) -> ConfigResult<()>
fn create_config( &self, alias: String, variables: HashMap<String, String>, description: Option<String>, ) -> ConfigResult<()>
fn update_config( &self, alias: String, variables: HashMap<String, String>, description: Option<String>, ) -> ConfigResult<()>
fn delete_config(&self, alias: String) -> ConfigResult<()>
fn get_config(&self, alias: &str) -> ConfigResult<Option<EnvConfig>>
fn list_configs(&self) -> ConfigResult<Vec<String>>
fn set_active_config(&self, alias: String) -> ConfigResult<()>
fn get_active_config(&self) -> ConfigResult<Option<String>>
fn clear_active_config(&self) -> ConfigResult<()>
Auto Trait Implementations§
impl Freeze for FileConfigManager
impl RefUnwindSafe for FileConfigManager
impl Send for FileConfigManager
impl Sync for FileConfigManager
impl Unpin for FileConfigManager
impl UnsafeUnpin for FileConfigManager
impl UnwindSafe for FileConfigManager
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