fn next_available_path(&self, p: &str, i: i32) -> Option<PathBuf> {
        let path = Path::new(p);
        let parent = path.parent()?.to_str()?;
        let stem = path.file_stem()?.to_str()?;
        let extension = path.extension()?.to_str()?;
        let dest = format!("{}/{}.{}.{}", parent, stem, i, extension);
        let new_path = Path::new(dest.as_str());
        if new_path.exists() {
            self.next_available_path(p, i + 1)
        } else {
            Some(new_path.to_owned())
        }
    }
/// computes the next available path by appending
computes the next available path by appending
computes the next available path by appending
fn next_available_path(&self, p: &str, i: i32) -> Option<PathBuf> {
        let path = Path::new(p);
        let parent = path.parent()?.to_str()?;
        let stem = path.file_stem()?.to_str()?;
        let extension = path.extension()?.to_str()?;
        let dest = format!("{}/{}.{}.{}", parent, stem, i, extension);
        let new_path = Path::new(dest.as_str());
        if new_path.exists() {
            self.next_available_path(p, i + 1)
        } else {
            Some(new_path.to_owned())
        }
    }
fn next_available_path ( & self , p : & str , i : i32 ) -> Option < PathBuf > { let path = Path :: new ( p ) ; let parent = path . parent ( ) ? . to_str ( ) ? ; let stem = path . file_stem ( ) ? . to_str ( ) ? ; let extension = path . extension ( ) ? . to_str ( ) ? ; let dest = format ! ( " " parent stem i extension ) ; let new_path = Path :: new ( dest . as_str ( ) ) ; if new_path . exists ( ) { self . next_available_path ( p , i + 1 ) } else { Some ( new_path . to_owned ( ) ) } }
computes the next available path by appending
computes the next available path by appending
&self
p
&str
i
i32