pub fn to_dest(&self, dest: &path::Path) -> crate::Result<()> {
    match self.temp {
      None => {
        fs::rename(self.source, dest)?;
      }
      Some(temp) => {
        println!("dest {}", dest.to_str().unwrap());
        println!("temp {}", temp.to_str().unwrap());
        println!("source {}", self.source.to_str().unwrap());
        if dest.exists() {
          fs::rename(dest, temp)?;
          if let Err(e) = fs::rename(self.source, dest) {
            fs::rename(temp, dest)?;
            return Err(e.into());
          }
        } else {
          fs::rename(self.source, dest)?;
        }
      }
    };
    Ok(())
  }
/// Move source file to specified destination
Move source file to specified destination
Move source file to specified destination
pub fn to_dest(&self, dest: &path::Path) -> crate::Result<()> {
    match self.temp {
      None => {
        fs::rename(self.source, dest)?;
      }
      Some(temp) => {
        println!("dest {}", dest.to_str().unwrap());
        println!("temp {}", temp.to_str().unwrap());
        println!("source {}", self.source.to_str().unwrap());
        if dest.exists() {
          fs::rename(dest, temp)?;
          if let Err(e) = fs::rename(self.source, dest) {
            fs::rename(temp, dest)?;
            return Err(e.into());
          }
        } else {
          fs::rename(self.source, dest)?;
        }
      }
    };
    Ok(())
  }
pub fn to_dest ( & self , dest : & path :: Path ) -> crate :: Result < ( ) > { match self . temp { None => { fs :: rename ( self . source , dest ) ? ; } Some ( temp ) => { println ! ( " " dest to_str ( ) unwrap ( ) ) ; println ! ( " " temp to_str ( ) unwrap ( ) ) ; println ! ( " " self source to_str ( ) unwrap ( ) ) ; if dest . exists ( ) { fs :: rename ( dest , temp ) ? ; if let Err ( e ) = fs :: rename ( self . source , dest ) { fs :: rename ( temp , dest ) ? ; return Err ( e . into ( ) ) ; } } else { fs :: rename ( self . source , dest ) ? ; } } } ; Ok ( ( ) ) }
Move source file to specified destination
Move source file to specified destination
&self
dest
&path::Path
&self
dest
&path::Path