doc.rust-lang.org/std/fs/fn.read_dir.html
Preview meta tags from the doc.rust-lang.org website.
Linked Hostnames
1General Meta Tags
6- titleread_dir in std::fs - Rust
- charsetutf-8
- viewportwidth=device-width, initial-scale=1.0
- generatorrustdoc
- descriptionReturns an iterator over the entries within a directory.
Link Tags
4- alternate icon../../static.files/favicon-32x32-6580c154.png
- icon../../static.files/favicon-044be391.svg
- stylesheet../../static.files/normalize-9960930a.css
- stylesheet../../static.files/rustdoc-1a91846b.css
Links
2- https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++use+std::io;%0A++++use+std::fs::%7Bself,+DirEntry%7D;%0A++++use+std::path::Path;%0A++++%0A++++//+one+possible+implementation+of+walking+a+directory+only+visiting+files%0A++++fn+visit_dirs(dir:+%26Path,+cb:+%26dyn+Fn(%26DirEntry))+-%3E+io::Result%3C()%3E+%7B%0A++++++++if+dir.is_dir()+%7B%0A++++++++++++for+entry+in+fs::read_dir(dir)?+%7B%0A++++++++++++++++let+entry+=+entry?;%0A++++++++++++++++let+path+=+entry.path();%0A++++++++++++++++if+path.is_dir()+%7B%0A++++++++++++++++++++visit_dirs(%26path,+cb)?;%0A++++++++++++++++%7D+else+%7B%0A++++++++++++++++++++cb(%26entry);%0A++++++++++++++++%7D%0A++++++++++++%7D%0A++++++++%7D%0A++++++++Ok(())%0A++++%7D%0A%7D&edition=2024
- https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Ause+std::%7Bfs,+io%7D;%0A%0Afn+main()+-%3E+io::Result%3C()%3E+%7B%0A++++let+mut+entries+=+fs::read_dir(%22.%22)?%0A++++++++.map(%7Cres%7C+res.map(%7Ce%7C+e.path()))%0A++++++++.collect::%3CResult%3CVec%3C_%3E,+io::Error%3E%3E()?;%0A%0A++++//+The+order+in+which+%60read_dir%60+returns+entries+is+not+guaranteed.+If+reproducible%0A++++//+ordering+is+required+the+entries+should+be+explicitly+sorted.%0A%0A++++entries.sort();%0A%0A++++//+The+entries+have+now+been+sorted+by+their+path.%0A%0A++++Ok(())%0A%7D&edition=2024