Struct std::fs::DirEntryStable
[-] [+]
[src]
pub struct DirEntry(_);
Entries returned by the ReadDir
iterator.
An instance of DirEntry
represents an entry inside of a directory on the
filesystem. Each entry can be inspected via methods to learn about the full
path or possibly other metadata through per-platform extension traits.
Methods
impl DirEntry
fn path(&self) -> PathBuf
Returns the full path to the file that this entry represents.
The full path is created by joining the original path to read_dir
or
walk_dir
with the filename of this entry.
Examples
extern crate std; fn main() { use std::fs; fn foo() -> std::io::Result<()> { for entry in try!(fs::read_dir(".")) { let dir = try!(entry); println!("{:?}", dir.path()); } Ok(()) } }use std::fs; for entry in try!(fs::read_dir(".")) { let dir = try!(entry); println!("{:?}", dir.path()); }
This prints output like:
"./whatever.txt"
"./foo.html"
"./hello_world.rs"
The exact text, of course, depends on what files you have in .
.