Suggest simpler fs helper methods in File::{open,create}
This commit is contained in:
@@ -334,6 +334,10 @@ impl File {
|
|||||||
///
|
///
|
||||||
/// See the [`OpenOptions::open`] method for more details.
|
/// 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
|
/// # Errors
|
||||||
///
|
///
|
||||||
/// This function will return an error if `path` does not already exist.
|
/// 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
|
/// Depending on the platform, this function may fail if the
|
||||||
/// full directory path does not exist.
|
/// full directory path does not exist.
|
||||||
///
|
|
||||||
/// See the [`OpenOptions::open`] function for more details.
|
/// 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
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
@@ -975,6 +981,9 @@ impl OpenOptions {
|
|||||||
/// In order for the file to be created, [`OpenOptions::write`] or
|
/// In order for the file to be created, [`OpenOptions::write`] or
|
||||||
/// [`OpenOptions::append`] access must be used.
|
/// [`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
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
|
|||||||
Reference in New Issue
Block a user