about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorTshepang Lekhonkhobe <tshepang@gmail.com>2015-12-03 21:50:09 +0200
committerTshepang Lekhonkhobe <tshepang@gmail.com>2015-12-03 23:40:26 +0200
commit446307012696723739a8022111ca450df4fffb61 (patch)
treee363c856380dab0a6ce8d5340a7304dcb878142d /src/libstd
parentf5150dd9b42d15563e18218910cafc0d4d053250 (diff)
downloadrust-446307012696723739a8022111ca450df4fffb61.tar.gz
rust-446307012696723739a8022111ca450df4fffb61.zip
doc: add example for std::fs::DirBuilder
Diffstat (limited to 'src/libstd')
-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())
     }