Skip to main content

FileConfigManager

Struct FileConfigManager 

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

File-based configuration manager

Implementations§

Source§

impl FileConfigManager

Source

pub fn new() -> ConfigResult<Self>

Create a new file-based configuration manager

Source

pub fn with_paths(config_paths: ConfigPaths) -> Self

Create with custom paths (mainly for testing)

Source

pub fn config_file_path(&self) -> &Path

Get the configuration file path

Source

pub fn config_file_exists(&self) -> bool

Check if configuration file exists

Source

pub fn config_file_size(&self) -> ConfigResult<u64>

Get configuration file size in bytes

Source

pub fn backup_config(&self) -> ConfigResult<PathBuf>

Create a backup of the current configuration file

Source

pub fn restore_from_backup(&self, backup_path: &Path) -> ConfigResult<()>

Restore configuration from a backup file

Source

pub fn export_to_file(&self, export_path: &Path) -> ConfigResult<()>

Export configurations to a file

Source

pub fn import_from_file( &self, import_path: &Path, merge: bool, ) -> ConfigResult<Vec<String>>

Import configurations from a file

Source

pub fn export_to_file_with_options( &self, export_path: &Path, options: &ExportOptions, ) -> ConfigResult<()>

Export configurations to a file with advanced options

Source

pub fn import_from_file_with_options( &self, import_path: &Path, options: &ImportOptions, ) -> ConfigResult<ImportResult>

Import configurations from a file with advanced options

Source

pub fn list_backups(&self) -> ConfigResult<Vec<PathBuf>>

List all backup files in the configuration directory

Source

pub fn cleanup_backups(&self, keep_count: usize) -> ConfigResult<usize>

Clean up old backup files, keeping only the most recent N backups

Source

pub fn get_stats(&self) -> ConfigResult<ConfigStats>

Get configuration statistics

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.