Rollup merge of #85766 - workingjubilee:file-options, r=yaahc
Stabilize File::options() Renames File::with_options to File::options, per consensus in rust-lang/rust#65439, and stabilizes it.
This commit is contained in:
commit
73ec27d359
1 changed files with 4 additions and 5 deletions
|
@ -358,7 +358,7 @@ impl File {
|
||||||
///
|
///
|
||||||
/// It is equivalent to `OpenOptions::new()` but allows you to write more
|
/// It is equivalent to `OpenOptions::new()` but allows you to write more
|
||||||
/// readable code. Instead of `OpenOptions::new().read(true).open("foo.txt")`
|
/// 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`.
|
/// also avoids the need to import `OpenOptions`.
|
||||||
///
|
///
|
||||||
/// See the [`OpenOptions::new`] function for more details.
|
/// See the [`OpenOptions::new`] function for more details.
|
||||||
|
@ -366,17 +366,16 @@ impl File {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// #![feature(with_options)]
|
|
||||||
/// use std::fs::File;
|
/// use std::fs::File;
|
||||||
///
|
///
|
||||||
/// fn main() -> std::io::Result<()> {
|
/// 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(())
|
/// Ok(())
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[unstable(feature = "with_options", issue = "65439")]
|
#[stable(feature = "with_options", since = "1.58.0")]
|
||||||
pub fn with_options() -> OpenOptions {
|
pub fn options() -> OpenOptions {
|
||||||
OpenOptions::new()
|
OpenOptions::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue