diff options
| author | bors <bors@rust-lang.org> | 2016-07-26 20:52:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-26 20:52:24 -0700 |
| commit | edecc57cbf4fb2444224c5c9492d58221ec885f0 (patch) | |
| tree | fdb8421077b032891009c119232516cbfb1c150b /src/libstd/sys | |
| parent | b541f5f0cc342dc6d31d7980f75c3d3d42f7587f (diff) | |
| parent | d64de045c96ccd8fd3e956f6b04e999563198ce2 (diff) | |
| download | rust-edecc57cbf4fb2444224c5c9492d58221ec885f0.tar.gz rust-edecc57cbf4fb2444224c5c9492d58221ec885f0.zip | |
Auto merge of #35053 - steveklabnik:rollup, r=steveklabnik
Rollup of 15 pull requests - Successful merges: #34461, #34609, #34732, #34850, #34935, #34974, #34990, #34995, #35001, #35009, #35010, #35019, #35028, #35029, #35043 - Failed merges:
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/unix/ext/fs.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index bb90a977433..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; } @@ -239,6 +255,16 @@ pub fn symlink<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<()> pub trait DirBuilderExt { /// Sets the mode to create new directories with. This option defaults to /// 0o777. + /// + /// # Examples + /// + /// ```ignore + /// use std::fs::DirBuilder; + /// use std::os::unix::fs::DirBuilderExt; + /// + /// let mut builder = DirBuilder::new(); + /// builder.mode(0o755); + /// ``` #[stable(feature = "dir_builder", since = "1.6.0")] fn mode(&mut self, mode: u32) -> &mut Self; } |
