io: Make Take::read_to_end public

Currently `Take::read_to_end` is private forcing users to use our
"custom" `read_to_limit`, for seasoned Rust hackers
`foo.take(16).read_to_end(buf)` make be more unsurprising.

Make `read_to_end` public.
This commit is contained in:
Tobin C. Harding 2024-01-18 07:42:17 +11:00
parent a3c4194c3f
commit 4cf2bf4b40
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 2 additions and 1 deletions

View File

@ -89,9 +89,10 @@ pub struct Take<'a, R: Read + ?Sized> {
}
impl<'a, R: Read + ?Sized> Take<'a, R> {
/// Reads all bytes until EOF from the underlying reader into `buf`.
#[cfg(any(feature = "alloc", feature = "std"))]
#[inline]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
pub fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
let mut read: usize = 0;
let mut chunk = [0u8; 64];
loop {