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::backup::ExternalConfig;
let config = ExternalConfig::new("rclone_config", "/path/to/rclone.conf")
.display_name("Rclone Configuration");§Command output
use rcman::backup::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::backup::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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ExternalConfig
impl !RefUnwindSafe for ExternalConfig
impl Send for ExternalConfig
impl Sync for ExternalConfig
impl Unpin for ExternalConfig
impl UnsafeUnpin for ExternalConfig
impl !UnwindSafe for ExternalConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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