about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2021-05-27 15:13:33 -0700
committerJubilee Young <workingjubilee@gmail.com>2021-11-09 10:22:28 -0800
commitcaf206b8202f4d417e39c378d424bc813f60bf99 (patch)
tree400c22a73a32969ea88867e5ee904da79757098e
parent07acdb48a0e0b22d08a45e3ced0378e0027b40eb (diff)
downloadrust-caf206b8202f4d417e39c378d424bc813f60bf99.tar.gz
rust-caf206b8202f4d417e39c378d424bc813f60bf99.zip
Stabilize File::options()
Renames File::with_options to File::options, per consensus in
rust-lang/rust#65439, and stabilizes it.
-rw-r--r--library/std/src/fs.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs
index e13add799bc..a14f1e2ecb2 100644
--- a/library/std/src/fs.rs
+++ b/library/std/src/fs.rs
@@ -358,7 +358,7 @@ impl File {
     ///
     /// It is equivalent to `OpenOptions::new()` but allows you to write more
     /// readable code. Instead of `OpenOptions::new().read(true).open("foo.txt")`
-    /// you can write `File::with_options().read(true).open("foo.txt")`. This
+    /// you can write `File::options().read(true).open("foo.txt")`. This
     /// also avoids the need to import `OpenOptions`.
     ///
     /// See the [`OpenOptions::new`] function for more details.
@@ -366,17 +366,16 @@ impl File {
     /// # Examples
     ///
     /// ```no_run
-    /// #![feature(with_options)]
     /// use std::fs::File;
     ///
     /// fn main() -> std::io::Result<()> {
-    ///     let mut f = File::with_options().read(true).open("foo.txt")?;
+    ///     let mut f = File::options().read(true).open("foo.txt")?;
     ///     Ok(())
     /// }
     /// ```
     #[must_use]
-    #[unstable(feature = "with_options", issue = "65439")]
-    pub fn with_options() -> OpenOptions {
+    #[stable(feature = "with_options", since = "1.58.0")]
+    pub fn options() -> OpenOptions {
         OpenOptions::new()
     }