diff options
| author | bors <bors@rust-lang.org> | 2015-12-04 03:26:46 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-12-04 03:26:46 +0000 |
| commit | 4cedff7be6f83714ebff07927c4bcc595f8a4ce4 (patch) | |
| tree | 19ff99ec2b7da67d687037fba0b3a4a7ea03d561 /src | |
| parent | 5854fed4ae80715107bfd8828c4af3fb6369faa5 (diff) | |
| parent | 446307012696723739a8022111ca450df4fffb61 (diff) | |
| download | rust-4cedff7be6f83714ebff07927c4bcc595f8a4ce4.tar.gz rust-4cedff7be6f83714ebff07927c4bcc595f8a4ce4.zip | |
Auto merge of #30190 - tshepang:dir_builder-example, r=alexcrichton
Diffstat (limited to 'src')
| -rw-r--r-- | src/libstd/fs.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 93ee8b47a50..7f256e6fae0 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -1299,6 +1299,20 @@ impl DirBuilder { /// Create the specified directory with the options configured in this /// builder. + /// + /// # Examples + /// + /// ```no_run + /// #![feature(dir_builder)] + /// use std::fs::{self, DirBuilder}; + /// + /// let path = "/tmp/foo/bar/baz"; + /// DirBuilder::new() + /// .recursive(true) + /// .create(path).unwrap(); + /// + /// assert!(fs::metadata(path).unwrap().is_dir()); + /// ``` pub fn create<P: AsRef<Path>>(&self, path: P) -> io::Result<()> { self._create(path.as_ref()) } |
