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:
parent
a3c4194c3f
commit
4cf2bf4b40
|
@ -89,9 +89,10 @@ pub struct Take<'a, R: Read + ?Sized> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, R: Read + ?Sized> Take<'a, R> {
|
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"))]
|
#[cfg(any(feature = "alloc", feature = "std"))]
|
||||||
#[inline]
|
#[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 read: usize = 0;
|
||||||
let mut chunk = [0u8; 64];
|
let mut chunk = [0u8; 64];
|
||||||
loop {
|
loop {
|
||||||
|
|
Loading…
Reference in New Issue