pub trait ConfigManager: Send + Sync {
// Required methods
fn load_config<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Config>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn save_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
config: &'life1 Config,
path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn update_dependency<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 DependencySpec,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn validate_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ConfigValidation>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_project_root(&self) -> &Path;
fn backup_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ConfigBackup>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn restore_backup<'life0, 'async_trait>(
&'life0 self,
backup: ConfigBackup,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn remove_backup<'life0, 'async_trait>(
&'life0 self,
backup: ConfigBackup,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
统一的配置管理接口
Required Methods§
Sourcefn load_config<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Config>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_config<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Config>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
加载配置文件
Sourcefn save_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
config: &'life1 Config,
path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
config: &'life1 Config,
path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
保存配置文件
Sourcefn update_dependency<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 DependencySpec,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_dependency<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 DependencySpec,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
更新依赖配置
Sourcefn validate_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ConfigValidation>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn validate_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ConfigValidation>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
验证配置文件
Sourcefn get_project_root(&self) -> &Path
fn get_project_root(&self) -> &Path
获取项目根目录
Sourcefn backup_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ConfigBackup>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn backup_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ConfigBackup>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
备份当前配置
Sourcefn restore_backup<'life0, 'async_trait>(
&'life0 self,
backup: ConfigBackup,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn restore_backup<'life0, 'async_trait>(
&'life0 self,
backup: ConfigBackup,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
恢复配置备份
Sourcefn remove_backup<'life0, 'async_trait>(
&'life0 self,
backup: ConfigBackup,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remove_backup<'life0, 'async_trait>(
&'life0 self,
backup: ConfigBackup,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
删除配置备份