More clearly document Stdin::read_line
These are common pitfalls for beginners, so I think it's worth making the subtleties more visible.
This commit is contained in:
parent
4cc494bbfe
commit
203573701a
@ -370,7 +370,12 @@ pub fn lock(&self) -> StdinLock<'static> {
|
|||||||
/// Locks this handle and reads a line of input, appending it to the specified buffer.
|
/// Locks this handle and reads a line of input, appending it to the specified buffer.
|
||||||
///
|
///
|
||||||
/// For detailed semantics of this method, see the documentation on
|
/// For detailed semantics of this method, see the documentation on
|
||||||
/// [`BufRead::read_line`].
|
/// [`BufRead::read_line`]. In particular:
|
||||||
|
/// * Previous content of the buffer will be preserved. To avoid appending
|
||||||
|
/// to the buffer, you need to [`clear`] it first.
|
||||||
|
/// * The trailing newline character, if any, is included in the buffer.
|
||||||
|
///
|
||||||
|
/// [`clear`]: String::clear
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user