pub fn write_all<W: std::io::Write>(&mut self, stream: &mut W) -> Result<bool, Error> {
        debug!("write_all, self = {:?}", self.write.buffer.as_slice());
        while self.write.len < self.write.buffer.len() {
            match self.write.buffer.write_all_from(self.write.len, stream) {
                Ok(s) => {
                    debug!("written {:?} bytes", s);
                    self.write.len += s;
                    self.write.bytes += s;
                    try!(stream.flush());
                }
                Err(e) => {
                    if e.kind() == std::io::ErrorKind::WouldBlock {
                        return Ok(false); // need more bytes
                    } else {
                        return Err(Error::IO(e));
                    }
                }
            }
        }
        self.write.buffer.clear();
        self.write.len = 0;
        Ok(true)
    }
// Returns true iff the write buffer has been completely written.
Returns true iff the write buffer has been completely written.
Returns true iff the write buffer has been completely written .
pub fn write_all<W: std::io::Write>(&mut self, stream: &mut W) -> Result<bool, Error> {
        debug!("write_all, self = {:?}", self.write.buffer.as_slice());
        while self.write.len < self.write.buffer.len() {
            match self.write.buffer.write_all_from(self.write.len, stream) {
                Ok(s) => {
                    debug!("written {:?} bytes", s);
                    self.write.len += s;
                    self.write.bytes += s;
                    try!(stream.flush());
                }
                Err(e) => {
                    if e.kind() == std::io::ErrorKind::WouldBlock {
                        return Ok(false); // need more bytes
                    } else {
                        return Err(Error::IO(e));
                    }
                }
            }
        }
        self.write.buffer.clear();
        self.write.len = 0;
        Ok(true)
    }
pub fn write_all < W : std :: io :: Write > ( & mut self , stream : & mut W ) -> Result < bool , Error > { debug ! ( " " self write buffer as_slice ( ) ) ; while self . write . len < self . write . buffer . len ( ) { match self . write . buffer . write_all_from ( self . write . len , stream ) { Ok ( s ) => { debug ! ( " " s ) ; self . write . len += s ; self . write . bytes += s ; try ! ( stream flush ( ) ) ; } Err ( e ) => { if e . kind ( ) == std :: io :: ErrorKind :: WouldBlock { return Ok ( false ) ; // need more bytes } else { return Err ( Error :: IO ( e ) ) ; } } } } self . write . buffer . clear ( ) ; self . write . len = 0 ; Ok ( true ) }
Returns true iff the write buffer has been completely written.
Returns true iff the write buffer has been completely written .
&mut self
stream
&mut W
&mut self
stream
&mut W