about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-12-04 03:26:46 +0000
committerbors <bors@rust-lang.org>2015-12-04 03:26:46 +0000
commit4cedff7be6f83714ebff07927c4bcc595f8a4ce4 (patch)
tree19ff99ec2b7da67d687037fba0b3a4a7ea03d561 /src
parent5854fed4ae80715107bfd8828c4af3fb6369faa5 (diff)
parent446307012696723739a8022111ca450df4fffb61 (diff)
downloadrust-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.rs14
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())
     }