fn generate_file_name(file_name: String) -> String {
    if !exists(&file_name) {
        return file_name;
    }
    let mut suffix: u32 = 1;
    loop {
        let candidate = format!("{}-{}", file_name, suffix);
        if !exists(&candidate) {
            return candidate;
        }
        suffix += 1;
    }
}
/// Find a file name that doesn't exist yet.
Find a file name that doesn't exist yet.
Find a file name that doesn ' t exist yet .
fn generate_file_name(file_name: String) -> String {
    if !exists(&file_name) {
        return file_name;
    }
    let mut suffix: u32 = 1;
    loop {
        let candidate = format!("{}-{}", file_name, suffix);
        if !exists(&candidate) {
            return candidate;
        }
        suffix += 1;
    }
}
fn generate_file_name ( file_name : String ) -> String { if ! exists ( & file_name ) { return file_name ; } let mut suffix : u32 = 1 ; loop { let candidate = format ! ( " " file_name suffix ) ; if ! exists ( & candidate ) { return candidate ; } suffix += 1 ; } }
Find a file name that doesn't exist yet.
Find a file name that doesn ' t exist yet .
file_name
String
file_name
String