Skip to main content

keep_both

Function keep_both 

Source
fn keep_both(
    dest: &Path,
    is_dir: bool,
    protect: &ProtectedPaths,
    put: impl FnMut(&Path) -> Result<()>,
) -> Result<PathBuf>
Expand description

Keep both: put at the first free name (2), name (3)… beside dest. Each attempt is itself the existence check (put must fail with AlreadyExists on a taken name), so a name taken by another writer between attempts moves on to the next number instead of overwriting.