about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKornel <kornel@geekhood.net>2023-01-01 18:04:26 +0000
committerKornel <kornel@geekhood.net>2023-01-01 18:04:26 +0000
commit3a6ceeb18f7f2bf6f5c8c647d4f747fdf47bef7b (patch)
tree9b410e5e17fa092eacb5b73d5c995aa8a129227c
parent1a983536f3ee798b18224658d5d4b406c952c64d (diff)
downloadrust-3a6ceeb18f7f2bf6f5c8c647d4f747fdf47bef7b.tar.gz
rust-3a6ceeb18f7f2bf6f5c8c647d4f747fdf47bef7b.zip
Document a way to limit read_line length
-rw-r--r--library/std/src/io/mod.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs
index 3f940279bf2..de528e85368 100644
--- a/library/std/src/io/mod.rs
+++ b/library/std/src/io/mod.rs
@@ -2153,10 +2153,11 @@ pub trait BufRead: Read {
     ///
     /// This function is blocking and should be used carefully: it is possible for
     /// an attacker to continuously send bytes without ever sending a newline
-    /// or EOF.
+    /// or EOF. You can use [`take`] to limit the maximum number of bytes read.
     ///
     /// [`Ok(0)`]: Ok
-    /// [`clear`]: String:::clear
+    /// [`clear`]: String::clear
+    /// [`take`]: crate::io::Read::take
     ///
     /// # Errors
     ///