File tree 1 file changed +6
-1
lines changed
library/std/src/io/buffered
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,9 @@ impl<R: Read> BufReader<R> {
94
94
pub fn with_capacity ( capacity : usize , inner : R ) -> BufReader < R > {
95
95
BufReader { inner, buf : Buffer :: with_capacity ( capacity) }
96
96
}
97
+ }
97
98
99
+ impl < R : Read + ?Sized > BufReader < R > {
98
100
/// Attempt to look ahead `n` bytes.
99
101
///
100
102
/// `n` must be less than `capacity`.
@@ -117,7 +119,10 @@ impl<R: Read> BufReader<R> {
117
119
/// assert_eq!(&s, "hello");
118
120
/// ```
119
121
#[ unstable( feature = "bufreader_peek" , issue = "128405" ) ]
120
- 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
+ {
121
126
assert ! ( n <= self . capacity( ) ) ;
122
127
while n > self . buf . buffer ( ) . len ( ) {
123
128
if self . buf . pos ( ) > 0 {
You can’t perform that action at this time.
0 commit comments