Skip to content

Commit

Permalink
Add description independent of Read::read_to_string
Browse files Browse the repository at this point in the history
  • Loading branch information
camelid committed Dec 30, 2020
1 parent 1f9a8a1 commit 4ee6d1b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions library/std/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down

0 comments on commit 4ee6d1b

Please sign in to comment.