Skip to content

Commit

Permalink
Document that you can't deserialize &str from reader
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 3, 2019
1 parent 5bc17fa commit 4c88bef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ where
R: io::Read,
{
/// Creates a JSON deserializer from an `io::Read`.
///
/// Reader-based deserializers do not support deserializing borrowed types
/// like `&str`, since the `std::io::Read` trait has no non-copying methods
/// -- everything it does involves copying bytes out of the data source.
pub fn from_reader(reader: R) -> Self {
Deserializer::new(read::IoRead::new(reader))
}
Expand Down

0 comments on commit 4c88bef

Please sign in to comment.