Guest User

Untitled

a guest
Jul 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. use std::collections::HashMap;
  2. use std::time::SystemTime;
  3. use std::path::Path;
  4. use std::path::PathBuf;
  5.  
  6. fn main() {
  7. println!("Hello, world!");
  8. println!("{}", "0000".to_string().parse::<i32>().unwrap());
  9. let mut pb = PathBuf::from("/user/");
  10. pb.push("hello.text");
  11. println!("{}", pb.display());
  12. }
  13.  
  14. fn read_dir<>(dir_path: &Path, mut hash_map: HashMap<&str, SystemTime>) {
  15. for entry in dir_path.read_dir().expect(&format!("Failed to read dir: {:?}", dir_path)) {
  16. if let Ok(entry) = entry {
  17. if let Ok(metadata) = entry.metadata() {
  18. // if metadata.is_dir() {
  19. // print!("This is a dir.");
  20. // } else {
  21. if let Some(path_str) = entry.path().to_str() {
  22. if let Ok(modified) = metadata.modified() {
  23. let a: & 'static str = "asdas";
  24. // let sss = &path_str.to_owned();
  25. hash_map.insert(a, modified);
  26. println!("{:?} - {:?}", path_str, modified);
  27. }
  28. }
  29. // }
  30. }
  31. }
  32. }
  33. }
Add Comment
Please, Sign In to add comment