Rollup merge of #129675 - lolbinarycat:bufreader_peek_unsized, r=workingjubilee

allow BufReader::peek to be called on unsized types

#128405
This commit is contained in:
Matthias Krüger 2024-08-31 10:08:55 +02:00 committed by GitHub
commit 10fb626958
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -94,7 +94,9 @@ pub fn new(inner: R) -> BufReader<R> {
pub fn with_capacity(capacity: usize, inner: R) -> BufReader<R> { pub fn with_capacity(capacity: usize, inner: R) -> BufReader<R> {
BufReader { inner, buf: Buffer::with_capacity(capacity) } BufReader { inner, buf: Buffer::with_capacity(capacity) }
} }
}
impl<R: Read + ?Sized> BufReader<R> {
/// Attempt to look ahead `n` bytes. /// Attempt to look ahead `n` bytes.
/// ///
/// `n` must be less than `capacity`. /// `n` must be less than `capacity`.