fn read_to_tendril<A>(&mut self, buf: &mut Tendril<fmt::Bytes, A>) -> io::Result<usize>
    where
        A: Atomicity,
    {
        // Adapted from libstd/io/mod.rs.
        const DEFAULT_BUF_SIZE: u32 = 64 * 1024;

        let start_len = buf.len();
        let mut len = start_len;
        let mut new_write_size = 16;
        let ret;
        loop {
            if len == buf.len() {
                if new_write_size < DEFAULT_BUF_SIZE {
                    new_write_size *= 2;
                }
                // FIXME: this exposes uninitialized bytes to a generic R type
                // this is fine for R=File which never reads these bytes,
                // but user-defined types might.
                // The standard library pushes zeros to `Vec<u8>` for that reason.
                unsafe {
                    buf.push_uninitialized(new_write_size);
                }
            }

            match self.read(&mut buf[len..]) {
                Ok(0) => {
                    ret = Ok(len - start_len);
                    break;
                }
                Ok(n) => len += n,
                Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {}
                Err(e) => {
                    ret = Err(e);
                    break;
                }
            }
        }

        let buf_len = buf.len32();
        buf.pop_back(buf_len - (len as u32));
        ret
    }
/// Read all bytes until EOF.
Read all bytes until EOF.
Read all bytes until EOF .
fn read_to_tendril<A>(&mut self, buf: &mut Tendril<fmt::Bytes, A>) -> io::Result<usize>
    where
        A: Atomicity,
    {
        // Adapted from libstd/io/mod.rs.
        const DEFAULT_BUF_SIZE: u32 = 64 * 1024;
        let start_len = buf.len();
        let mut len = start_len;
        let mut new_write_size = 16;
        let ret;
        loop {
            if len == buf.len() {
                if new_write_size < DEFAULT_BUF_SIZE {
                    new_write_size *= 2;
                }
                // FIXME: this exposes uninitialized bytes to a generic R type
                // this is fine for R=File which never reads these bytes,
                // but user-defined types might.
                // The standard library pushes zeros to `Vec<u8>` for that reason.
                unsafe {
                    buf.push_uninitialized(new_write_size);
                }
            }
            match self.read(&mut buf[len..]) {
                Ok(0) => {
                    ret = Ok(len - start_len);
                    break;
                }
                Ok(n) => len += n,
                Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {}
                Err(e) => {
                    ret = Err(e);
                    break;
                }
            }
        }
        let buf_len = buf.len32();
        buf.pop_back(buf_len - (len as u32));
        ret
    }
fn read_to_tendril < A > ( & mut self , buf : & mut Tendril < fmt :: Bytes , A > ) -> io :: Result < usize > where A : Atomicity , { // Adapted from libstd/io/mod.rs. const DEFAULT_BUF_SIZE : u32 = 64 * 1024 ; let start_len = buf . len ( ) ; let mut len = start_len ; let mut new_write_size = 16 ; let ret ; loop { if len == buf . len ( ) { if new_write_size < DEFAULT_BUF_SIZE { new_write_size *= 2 ; } // FIXME: this exposes uninitialized bytes to a generic R type // this is fine for R=File which never reads these bytes, // but user-defined types might. // The standard library pushes zeros to `Vec<u8>` for that reason. unsafe { buf . push_uninitialized ( new_write_size ) ; } } match self . read ( & mut buf [ len .. ] ) { Ok ( 0 ) => { ret = Ok ( len - start_len ) ; break ; } Ok ( n ) => len += n , Err ( ref e ) if e . kind ( ) == io :: ErrorKind :: Interrupted => { } Err ( e ) => { ret = Err ( e ) ; break ; } } } let buf_len = buf . len32 ( ) ; buf . pop_back ( buf_len - ( len as u32 ) ) ; ret }
Read all bytes until EOF.
Read all bytes until EOF .
&mut self
buf
&mut Tendril<fmt::Bytes, A>