【Rust】ディレクトリのパス一覧をStringでVectorに入れる

時間かかったー

fn main() -> Result<(), Box<dyn std::error::Error>>{    

    let mut entries: Vec<String> = Vec::new();
    let dir = Path::new("./src");
    if dir.is_dir(){
        for entry in fs::read_dir(dir)? {
            let e = entry?;
            let p = e.path().file_name().unwrap().to_string_lossy().into_owned();
            entries.push(p);
        }
    }
    println!("{:?}", entries);
    Ok(())
}

Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.31s
Running `target/debug/parallel queue`
[“pipeline.rs”, “unix_domain_socket.rs”, “password_cracking.rs”, “shared_ipc.rs”, “main.rs”, “child_processes.rs”, “multithreading.rs”, “queue.rs”, “thread_pool.rs”, “password_cracking_parallel.rs”, “unixstream.rs”, “pipe.rs”]