pub struct ExternalConfig {
pub id: String,
pub archive_filename: String,
pub display_name: String,
pub description: Option<String>,
pub export_source: ExportSource,
pub import_target: ImportTarget,
pub is_sensitive: bool,
pub optional: bool,
pub is_directory: bool,
}Expand description
External configuration managed by the app
Use this to register external files, command outputs, or dynamic data that should be available for backup export and restore.
§Examples
§File-based config (traditional)
use rcman::ExternalConfig;
let config = ExternalConfig::new("rclone_config", "/path/to/rclone.conf")
.display_name("Rclone Configuration");§Command output
use rcman::ExternalConfig;
let config = ExternalConfig::from_command("rclone_dump", "rclone_dump.json")
.export_command("rclone", &["config", "dump"])
.import_read_only() // Cannot restore command output directly
.display_name("Rclone Config Dump");§In-memory content
use rcman::ExternalConfig;
let api_data = b"{ \"key\": \"value\" }".to_vec();
let config = ExternalConfig::from_content("cloud_config", "cloud.json", api_data)
.display_name("Cloud Settings");Fields§
§id: StringUnique identifier for referencing in BackupOptions
archive_filename: StringFilename used inside the backup archive
display_name: StringHuman-readable name for display
description: Option<String>Description of what this config contains
export_source: ExportSourceHow to get the data for export
import_target: ImportTargetHow to restore the data on import
is_sensitive: boolWhether this config contains sensitive data
optional: boolWhether this config is optional for export (default: false)
is_directory: boolWhether this is a directory (for File source, default: false)
Implementations§
Source§impl ExternalConfig
impl ExternalConfig
Sourcepub fn new(id: impl Into<String>, path: impl Into<PathBuf>) -> Self
pub fn new(id: impl Into<String>, path: impl Into<PathBuf>) -> Self
Create a new file-based external config (backward compatible)
This is the traditional way to register a config file. Both export and import will use the same file path.
§Arguments
id- Unique identifier (used inBackupOptions::include_external)path- Path to the file or directory
Sourcepub fn from_command(
id: impl Into<String>,
archive_filename: impl Into<String>,
) -> Self
pub fn from_command( id: impl Into<String>, archive_filename: impl Into<String>, ) -> Self
Create a config that exports from a command’s stdout
§Arguments
id- Unique identifierarchive_filename- Filename to use inside the backup archive
Sourcepub fn from_content(
id: impl Into<String>,
archive_filename: impl Into<String>,
content: Vec<u8>,
) -> Self
pub fn from_content( id: impl Into<String>, archive_filename: impl Into<String>, content: Vec<u8>, ) -> Self
Create a config from in-memory content
§Arguments
id- Unique identifierarchive_filename- Filename to use inside the backup archivecontent- The bytes to include in the backup
Sourcepub fn export_command(self, program: impl Into<String>, args: &[&str]) -> Self
pub fn export_command(self, program: impl Into<String>, args: &[&str]) -> Self
Set the export command (for Command source)
Sourcepub fn import_file(self, path: impl Into<PathBuf>) -> Self
pub fn import_file(self, path: impl Into<PathBuf>) -> Self
Set import to write to a file
Sourcepub fn import_command(self, program: impl Into<String>, args: &[&str]) -> Self
pub fn import_command(self, program: impl Into<String>, args: &[&str]) -> Self
Set import to pipe to a command’s stdin
Sourcepub fn import_handler<F>(self, handler: F) -> Self
pub fn import_handler<F>(self, handler: F) -> Self
Set import to use a custom handler
Sourcepub fn import_read_only(self) -> Self
pub fn import_read_only(self) -> Self
Mark import as read-only (cannot be restored)
Sourcepub fn display_name(self, name: impl Into<String>) -> Self
pub fn display_name(self, name: impl Into<String>) -> Self
Set a human-readable display name
Sourcepub fn description(self, desc: impl Into<String>) -> Self
pub fn description(self, desc: impl Into<String>) -> Self
Set a description
Sourcepub fn optional(self) -> Self
pub fn optional(self) -> Self
Mark this config as optional (not included by default in full backup)
Trait Implementations§
Source§impl Clone for ExternalConfig
impl Clone for ExternalConfig
Source§fn clone(&self) -> ExternalConfig
fn clone(&self) -> ExternalConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more