Struct rustic_core::RestoreOptions

source ·
pub struct RestoreOptions {
    pub delete: bool,
    pub numeric_id: bool,
    pub no_ownership: bool,
    pub verify_existing: bool,
}
Expand description

Options for the restore command

Fields§

§delete: bool

Remove all files/dirs in destination which are not contained in snapshot.

§Warning

Use with care, maybe first try this with –dry-run?

§numeric_id: bool

Use numeric ids instead of user/group when restoring uid/gui

§no_ownership: bool

Don’t restore ownership (user/group)

§verify_existing: bool

Always read and verify existing files (don’t trust correct modification time and file size)

Implementations§

source§

impl RestoreOptions

source

pub fn delete(self, value: impl Into<bool>) -> Self

Sets the delete field of this struct.

source

pub fn numeric_id(self, value: impl Into<bool>) -> Self

Sets the numeric_id field of this struct.

source

pub fn no_ownership(self, value: impl Into<bool>) -> Self

Sets the no_ownership field of this struct.

source

pub fn verify_existing(self, value: impl Into<bool>) -> Self

Sets the verify_existing field of this struct.

source§

impl RestoreOptions

source

pub(crate) fn restore<P: ProgressBars, S: IndexedTree>( self, file_infos: RestorePlan, repo: &Repository<P, S>, node_streamer: impl Iterator<Item = RusticResult<(PathBuf, Node)>>, dest: &LocalDestination, ) -> RusticResult<()>

Restore the repository to the given destination.

§Type Parameters
  • P - The progress bar type.
  • S - The type of the indexed tree.
§Arguments
  • file_infos - The restore information.
  • repo - The repository to restore.
  • node_streamer - The node streamer to use.
  • dest - The destination to restore to.
§Errors

If the restore failed.

source

pub(crate) fn collect_and_prepare<P: ProgressBars, S: IndexedFull>( self, repo: &Repository<P, S>, node_streamer: impl Iterator<Item = RusticResult<(PathBuf, Node)>>, dest: &LocalDestination, dry_run: bool, ) -> RusticResult<RestorePlan>

Collect restore information, scan existing files, create needed dirs and remove superfluous files

§Type Parameters
  • P - The progress bar type.
  • S - The type of the indexed tree.
§Arguments
  • repo - The repository to restore.
  • node_streamer - The node streamer to use.
  • dest - The destination to restore to.
  • dry_run - If true, don’t actually restore anything, but only print out what would be done.
§Errors
source

fn restore_metadata( self, node_streamer: impl Iterator<Item = RusticResult<(PathBuf, Node)>>, dest: &LocalDestination, ) -> RusticResult<()>

Restore the metadata of the files and directories.

§Arguments
  • node_streamer - The node streamer to use.
  • dest - The destination to restore to.
§Errors

If the restore failed.

source

fn set_metadata(self, dest: &LocalDestination, path: &PathBuf, node: &Node)

Set the metadata of the given file or directory.

§Arguments
  • dest - The destination to restore to.
  • path - The path of the file or directory.
  • node - The node information of the file or directory.
§Errors

If the metadata could not be set.

Trait Implementations§

source§

impl Args for RestoreOptions

source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self. Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can update self. Read more
source§

impl Clone for RestoreOptions

source§

fn clone(&self) -> RestoreOptions

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl CommandFactory for RestoreOptions

source§

fn command<'b>() -> Command

Build a Command that can instantiate Self. Read more
source§

fn command_for_update<'b>() -> Command

Build a Command that can update self. Read more
source§

impl Debug for RestoreOptions

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for RestoreOptions

source§

fn default() -> RestoreOptions

Returns the “default value” for a type. Read more
source§

impl FromArgMatches for RestoreOptions

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

impl Parser for RestoreOptions

source§

fn parse() -> Self

Parse from std::env::args_os(), exit on error.
source§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
source§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, exit on error.
source§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
source§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, exit on error.
source§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.
source§

impl Copy for RestoreOptions

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V