pub struct Backup<'a> {
    pub source_file_path: &'a Path,
    pub source_file_hash: &'a str,
    pub date_time: DateTime<Local>,
}
Expand description

Settings of a backup.

Fields

source_file_path: &'a Path

Path to the source file.

source_file_hash: &'a str

Hash of the source file in hexadecimal string.

date_time: DateTime<Local>

Current date time.

Implementations

Create a builder for building Backup. On the builder, call .source_file_path(...), .source_file_hash(...), .date_time(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of Backup.

Construct backup file path.

Copy the original file to the backup destination.

If the backup destination already exists, skip copying and return Ok(false).

If the backup destination does not exist, perform copying and return Ok(true).

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Apply f to self. Read more

Apply f to &self. Read more

Apply f to &mut self. Read more

Apply f to &self where f takes a single parameter of type Param and Self implements trait AsRef<Param>. Read more

Apply f to &mut self where f takes a single parameter of type Param and Self implements trait AsMut<Param>. Read more

Apply f to &self where f takes a single parameter of type Param and Self implements trait Deref<Target = Param>. Read more

Apply f to &mut self where f takes a single parameter of type Param and Self implements trait [DerefMut<Target = Param>]. Read more

Apply f to &self where f takes a single parameter of type Param and Self implements trait Borrow<Param>. Read more

Apply f to &mut self where f takes a single parameter of type Param and Self implements trait BorrowMut<Param>. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.