about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-03-16 09:40:03 +0800
committerGitHub <noreply@github.com>2025-03-16 09:40:03 +0800
commitf16ce2ae6ce84428a7df8ed6b9745815ed6c1ca4 (patch)
treee1a6ec6abace7f202f1fbde852b4c28f2749d527
parent903b526e3242e6bd70ddb5ef8a2b891ae8265b8e (diff)
parent57046e1470385078c866cbe2e2d5bfb0c666d0fd (diff)
downloadrust-f16ce2ae6ce84428a7df8ed6b9745815ed6c1ca4.tar.gz
rust-f16ce2ae6ce84428a7df8ed6b9745815ed6c1ca4.zip
Rollup merge of #137890 - lolbinarycat:docs-bufreader-peek-consume, r=Mark-Simulacrum
doc: clarify that consume can be called after BufReader::peek

tracking issue #128405
-rw-r--r--library/std/src/io/buffered/bufreader.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/library/std/src/io/buffered/bufreader.rs b/library/std/src/io/buffered/bufreader.rs
index 697fb5974a3..40441dc057d 100644
--- a/library/std/src/io/buffered/bufreader.rs
+++ b/library/std/src/io/buffered/bufreader.rs
@@ -109,9 +109,13 @@ impl<R: Read + ?Sized> BufReader<R> {
     ///
     /// `n` must be less than or equal to `capacity`.
     ///
-    /// the returned slice may be less than `n` bytes long if
+    /// The returned slice may be less than `n` bytes long if
     /// end of file is reached.
     ///
+    /// After calling this method, you may call [`consume`](BufRead::consume)
+    /// with a value less than or equal to `n` to advance over some or all of
+    /// the returned bytes.
+    ///
     /// ## Examples
     ///
     /// ```rust