Skip to content

Commit 4463070

Browse files
committed
doc: add example for std::fs::DirBuilder
1 parent f5150dd commit 4463070

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/libstd/fs.rs

+14
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,20 @@ impl DirBuilder {
12991299

13001300
/// Create the specified directory with the options configured in this
13011301
/// builder.
1302+
///
1303+
/// # Examples
1304+
///
1305+
/// ```no_run
1306+
/// #![feature(dir_builder)]
1307+
/// use std::fs::{self, DirBuilder};
1308+
///
1309+
/// let path = "/tmp/foo/bar/baz";
1310+
/// DirBuilder::new()
1311+
/// .recursive(true)
1312+
/// .create(path).unwrap();
1313+
///
1314+
/// assert!(fs::metadata(path).unwrap().is_dir());
1315+
/// ```
13021316
pub fn create<P: AsRef<Path>>(&self, path: P) -> io::Result<()> {
13031317
self._create(path.as_ref())
13041318
}

0 commit comments

Comments
 (0)