diff options
| author | Camelid <camelidcamel@gmail.com> | 2020-12-30 11:33:06 -0800 |
|---|---|---|
| committer | Camelid <camelidcamel@gmail.com> | 2020-12-30 11:35:17 -0800 |
| commit | 4ee6d1bf541a90206b9e5cba6840e774493abc57 (patch) | |
| tree | f8cabf3aa68857a59458216725e6bfe9dbea3701 | |
| parent | 1f9a8a1620a677d668c981a8e6be3ce02ef06cd5 (diff) | |
| download | rust-4ee6d1bf541a90206b9e5cba6840e774493abc57.tar.gz rust-4ee6d1bf541a90206b9e5cba6840e774493abc57.zip | |
Add description independent of `Read::read_to_string`
| -rw-r--r-- | library/std/src/io/mod.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index 7a1896e4e59..1fdd82400d0 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -945,12 +945,13 @@ pub trait Read { } } -/// Convenience function for [`Read::read_to_string`]. +/// Read all bytes from a [reader][Read] into a new [`String`]. /// -/// This avoids having to create a variable first and it provides more type safety -/// since you can only get the buffer out if there were no errors. (If you use -/// [`Read::read_to_string`] you have to remember to check whether the read succeeded -/// because otherwise your buffer will be empty.) +/// This is a convenience function for [`Read::read_to_string`]. Using this +/// function avoids having to create a variable first and provides more type +/// safety since you can only get the buffer out if there were no errors. (If you +/// use [`Read::read_to_string`] you have to remember to check whether the read +/// succeeded because otherwise your buffer will be empty.) /// /// # Examples /// |
