Skip to content

Commit 65bbd1a

Browse files
Fix example of from_reader not applying buffering when it should
1 parent 87f78da commit 65bbd1a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/de.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2568,6 +2568,7 @@ where
25682568
///
25692569
/// use std::error::Error;
25702570
/// use std::net::{TcpListener, TcpStream};
2571+
/// use std::io::BufReader;
25712572
///
25722573
/// #[derive(Deserialize, Debug)]
25732574
/// struct User {
@@ -2576,7 +2577,8 @@ where
25762577
/// }
25772578
///
25782579
/// fn read_user_from_stream(tcp_stream: TcpStream) -> Result<User, Box<dyn Error>> {
2579-
/// let mut de = serde_json::Deserializer::from_reader(tcp_stream);
2580+
/// let buf_tcp_stream = BufReader::new(tcp_stream);
2581+
/// let mut de = serde_json::Deserializer::from_reader(buf_tcp_stream);
25802582
/// let u = User::deserialize(&mut de)?;
25812583
///
25822584
/// Ok(u)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy