Skip to main content

PathExt

Trait PathExt 

Source
pub trait PathExt: AsRef<Path> {
    // Provided methods
    fn copy_file_to<Q, F>(
        &self,
        new_path: Q,
        progress_callback: ProgressCallback<F>,
    ) -> Result<()>
       where Q: AsRef<Path>,
             F: FnMut(ProgressStatus) -> ProgressRetVal { ... }
    fn move_to<Q, F>(
        &self,
        new_path: Q,
        progress_callback: ProgressCallback<F>,
    ) -> Result<()>
       where Q: AsRef<Path>,
             F: FnMut(ProgressStatus) -> ProgressRetVal { ... }
}
Available on crate feature fs only.
Expand description

Additional methods on Path using Windows-specific functionality.

Provided Methods§

Source

fn copy_file_to<Q, F>( &self, new_path: Q, progress_callback: ProgressCallback<F>, ) -> Result<()>

Copies a file.

  • Will copy symlinks themselves, not their targets.
  • Will block until the operation is complete.
  • Will fail if the target path already exists.
  • Supports file names longer than MAX_PATH characters.

Progress notifications can be enabled using a ProgressCallback. Use Default::default to disable.

Source

fn move_to<Q, F>( &self, new_path: Q, progress_callback: ProgressCallback<F>, ) -> Result<()>

Moves a file or directory within a volume or a file between volumes.

  • The operation is equivalent to a rename if the new path is on the same volume.
  • Only files can be moved between volumes, not directories.
  • Will move symlinks themselves, not their targets.
  • Symlinks can be moved within the same volume (renamed) without extended permission.
  • Will block until the operation is complete.
  • Will fail if the target path already exists.
  • Supports file names longer than MAX_PATH characters.

Progress notifications can be enabled using a ProgressCallback. Use Default::default to disable.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: AsRef<Path>> PathExt for T