mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Suggest simpler fs helper methods in File::{open,create}
This commit is contained in:
parent
15adc7b5e4
commit
4c2d48ee80
@ -334,6 +334,10 @@ impl File {
|
||||
///
|
||||
/// See the [`OpenOptions::open`] method for more details.
|
||||
///
|
||||
/// If you only need to read the entire file contents,
|
||||
/// consider [`std::fs::read()`][self::read] or
|
||||
/// [`std::fs::read_to_string()`][self::read_to_string] instead.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// This function will return an error if `path` does not already exist.
|
||||
@ -364,9 +368,11 @@ impl File {
|
||||
///
|
||||
/// Depending on the platform, this function may fail if the
|
||||
/// full directory path does not exist.
|
||||
///
|
||||
/// See the [`OpenOptions::open`] function for more details.
|
||||
///
|
||||
/// See also [`std::fs::write()`][self::write] for a simple function to
|
||||
/// create a file with a given data.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
@ -975,6 +981,9 @@ impl OpenOptions {
|
||||
/// In order for the file to be created, [`OpenOptions::write`] or
|
||||
/// [`OpenOptions::append`] access must be used.
|
||||
///
|
||||
/// See also [`std::fs::write()`][self::write] for a simple function to
|
||||
/// create a file with a given data.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
|
Loading…
Reference in New Issue
Block a user