Document a way to limit read_line length

This commit is contained in:
Kornel 2023-01-01 18:04:26 +00:00
parent 1a983536f3
commit 3a6ceeb18f

View File

@ -2153,10 +2153,11 @@ fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize> {
/// ///
/// This function is blocking and should be used carefully: it is possible for /// This function is blocking and should be used carefully: it is possible for
/// an attacker to continuously send bytes without ever sending a newline /// 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 /// [`Ok(0)`]: Ok
/// [`clear`]: String:::clear /// [`clear`]: String::clear
/// [`take`]: crate::io::Read::take
/// ///
/// # Errors /// # Errors
/// ///