We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 600edc9 commit 6280499Copy full SHA for 6280499
library/std/src/io/buffered/bufreader.rs
@@ -94,7 +94,9 @@ impl<R: Read> BufReader<R> {
94
pub fn with_capacity(capacity: usize, inner: R) -> BufReader<R> {
95
BufReader { inner, buf: Buffer::with_capacity(capacity) }
96
}
97
+}
98
99
+impl<R: Read + ?Sized> BufReader<R> {
100
/// Attempt to look ahead `n` bytes.
101
///
102
/// `n` must be less than `capacity`.
@@ -117,7 +119,10 @@ impl<R: Read> BufReader<R> {
117
119
/// assert_eq!(&s, "hello");
118
120
/// ```
121
#[unstable(feature = "bufreader_peek", issue = "128405")]
- pub fn peek(&mut self, n: usize) -> io::Result<&[u8]> {
122
+ pub fn peek(&mut self, n: usize) -> io::Result<&[u8]>
123
+ where
124
+ R: ?Sized,
125
+ {
126
assert!(n <= self.capacity());
127
while n > self.buf.buffer().len() {
128
if self.buf.pos() > 0 {
0 commit comments