diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2016-07-26 17:21:13 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-26 17:21:13 -0400 |
| commit | 57d50299a7621d652fc668045d8f85e5703514d6 (patch) | |
| tree | c6bfde53b249d1d9891b7f568ff93124244db649 /src/libstd/sys | |
| parent | 905e35f30b70776dd6360c5c03c5608286c46636 (diff) | |
| parent | 16699635bc467b0940c11675dd73e7e444088c4e (diff) | |
| download | rust-57d50299a7621d652fc668045d8f85e5703514d6.tar.gz rust-57d50299a7621d652fc668045d8f85e5703514d6.zip | |
Rollup merge of #35009 - GuillaumeGomez:dir_entry_doc, r=steveklabnik
Dir entry doc Part of #29356. r? @steveklabnik
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/unix/ext/fs.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index d1f26fec249..54340773a42 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -196,6 +196,22 @@ impl FileTypeExt for fs::FileType { pub trait DirEntryExt { /// Returns the underlying `d_ino` field in the contained `dirent` /// structure. + /// + /// # Examples + /// + /// ``` + /// use std::fs; + /// use std::os::unix::fs::DirEntryExt; + /// + /// if let Ok(entries) = fs::read_dir(".") { + /// for entry in entries { + /// if let Ok(entry) = entry { + /// // Here, `entry` is a `DirEntry`. + /// println!("{:?}: {}", entry.file_name(), entry.ino()); + /// } + /// } + /// } + /// ``` #[stable(feature = "dir_entry_ext", since = "1.1.0")] fn ino(&self) -> u64; } |
