Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::collections::HashMap;
- use std::time::SystemTime;
- use std::path::Path;
- use std::path::PathBuf;
- fn main() {
- println!("Hello, world!");
- println!("{}", "0000".to_string().parse::<i32>().unwrap());
- let mut pb = PathBuf::from("/user/");
- pb.push("hello.text");
- println!("{}", pb.display());
- }
- fn read_dir<>(dir_path: &Path, mut hash_map: HashMap<&str, SystemTime>) {
- for entry in dir_path.read_dir().expect(&format!("Failed to read dir: {:?}", dir_path)) {
- if let Ok(entry) = entry {
- if let Ok(metadata) = entry.metadata() {
- // if metadata.is_dir() {
- // print!("This is a dir.");
- // } else {
- if let Some(path_str) = entry.path().to_str() {
- if let Ok(modified) = metadata.modified() {
- let a: & 'static str = "asdas";
- // let sss = &path_str.to_owned();
- hash_map.insert(a, modified);
- println!("{:?} - {:?}", path_str, modified);
- }
- }
- // }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment