pub trait SingleFileOperation: RollbackableOperation + Drop {
// Required methods
fn get_path(&self) -> &Path;
fn get_backup_path(&self) -> &Path;
fn set_backup_path<S: AsRef<Path>>(&mut self, uuid: S);
fn get_temp_dir(&self) -> &Path;
// Provided methods
fn dispose(&self) -> Result<()> { ... }
fn create_backup_file(&mut self) -> Result<()> { ... }
}
Expand description
Trait that represents a single file operation
Required Methods§
Sourcefn get_backup_path(&self) -> &Path
fn get_backup_path(&self) -> &Path
Returns path to backup file
Defaults to “”
Sourcefn set_backup_path<S: AsRef<Path>>(&mut self, uuid: S)
fn set_backup_path<S: AsRef<Path>>(&mut self, uuid: S)
Sets the backup path
Sourcefn get_temp_dir(&self) -> &Path
fn get_temp_dir(&self) -> &Path
Returns path to temp dir
Provided Methods§
Sourcefn dispose(&self) -> Result<()>
fn dispose(&self) -> Result<()>
Dispose off resources used by the operation
It should be called inside Drop
Sourcefn create_backup_file(&mut self) -> Result<()>
fn create_backup_file(&mut self) -> Result<()>
Creates a backup of the source file
If backup file is successfully created, method should call set_backup_path
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.