Skip to content

Commit

Permalink
Add error docs
Browse files Browse the repository at this point in the history
  • Loading branch information
camelid committed Dec 30, 2020
1 parent 4ee6d1b commit 588786a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion library/std/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,14 @@ pub trait Read {
/// 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.)
/// succeeded because otherwise your buffer will be empty or only partially full.)
///
/// # Errors
///
/// This function forces you to handle errors because the output (the `String`)
/// is wrapped in a [`Result`]. See [`Read::read_to_string`] for the errors
/// that can occur. If any error occurs, you will get an [`Err`], so you
/// don't have to worry about your buffer being empty or partially full.
///
/// # Examples
///
Expand Down

0 comments on commit 588786a

Please sign in to comment.