diff --git a/src/de.rs b/src/de.rs index b1f4b84c3..ec9c74664 100644 --- a/src/de.rs +++ b/src/de.rs @@ -45,11 +45,17 @@ where /// Create a JSON deserializer from one of the possible serde_json input /// sources. /// + /// When reading from a source against which short reads are not efficient, such + /// as a [`File`], you will want to apply your own buffering because serde_json + /// will not buffer the input. See [`std::io::BufReader`]. + /// /// Typically it is more convenient to use one of these methods instead: /// /// - Deserializer::from_str /// - Deserializer::from_slice /// - Deserializer::from_reader + /// + /// [`File`]: https://doc.rust-lang.org/std/fs/struct.File.html pub fn new(read: R) -> Self { Deserializer { read, diff --git a/src/read.rs b/src/read.rs index b4128467b..ef97493be 100644 --- a/src/read.rs +++ b/src/read.rs @@ -191,6 +191,12 @@ where R: io::Read, { /// Create a JSON input source to read from a std::io input stream. + /// + /// When reading from a source against which short reads are not efficient, such + /// as a [`File`], you will want to apply your own buffering because serde_json + /// will not buffer the input. See [`std::io::BufReader`]. + /// + /// [`File`]: https://doc.rust-lang.org/std/fs/struct.File.html pub fn new(reader: R) -> Self { IoRead { iter: LineColIterator::new(reader.bytes()),