diff options
| author | Kornel <kornel@geekhood.net> | 2023-02-15 18:48:19 +0000 |
|---|---|---|
| committer | Kornel <kornel@geekhood.net> | 2023-02-15 18:58:38 +0000 |
| commit | 4c2d48ee800dd79bfb64b91ccee5262295fea9d5 (patch) | |
| tree | e2447b95c2095493af55d6acb8f2429505dc9091 /library/std/src | |
| parent | 15adc7b5e430bdef0c6ba1526b510878ac0c69eb (diff) | |
| download | rust-4c2d48ee800dd79bfb64b91ccee5262295fea9d5.tar.gz rust-4c2d48ee800dd79bfb64b91ccee5262295fea9d5.zip | |
Suggest simpler fs helper methods in File::{open,create}
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/fs.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 8a2799b17b9..c550378e7d6 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -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 |
