diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2016-07-28 12:55:58 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2016-07-28 12:55:58 +0200 |
| commit | 8d3f20f9061273b215a7d86f8783f1ae66f9b3ae (patch) | |
| tree | 1f9cfdf5d01689d511964141e79a2181cd9b7d69 | |
| parent | 52c50ba276ffbdbe9c1a56e4f0b7d424f6bc22cc (diff) | |
| download | rust-8d3f20f9061273b215a7d86f8783f1ae66f9b3ae.tar.gz rust-8d3f20f9061273b215a7d86f8783f1ae66f9b3ae.zip | |
Add doc examples for std::fs::unix::OpenOptionsExt
| -rw-r--r-- | src/libstd/sys/unix/ext/fs.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index 54340773a42..1e0dc3c833e 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -63,6 +63,18 @@ pub trait OpenOptionsExt { /// If no `mode` is set, the default of `0o666` will be used. /// The operating system masks out bits with the systems `umask`, to produce /// the final permissions. + /// + /// # Examples + /// + /// ```rust,ignore + /// extern crate libc; + /// use std::fs::OpenOptions; + /// use std::os::unix::fs::OpenOptionsExt; + /// + /// let mut options = OpenOptions::new(); + /// options.mode(0o644); // Give read/write for owner and read for others. + /// let file = options.open("foo.txt"); + /// ``` #[stable(feature = "fs_ext", since = "1.1.0")] fn mode(&mut self, mode: u32) -> &mut Self; |
