pub fn add(&mut self, data: &[u8]) -> Result<usize> {
        let mut consumed = 0;
        
        if self.header.is_none() {
            consumed += try!(self.read_header(data));
            if let Some(header) = self.header {
                self.expected = header.size as usize;
            }
        }
        
        if self.header.is_some() {
            consumed += self.read_body(&data[consumed..]);
        }
        
        Ok(consumed)
    }
/// Process a new chunk of data and return the number of bytes used.
Process a new chunk of data and return the number of bytes used.
Process a new chunk of data and return the number of bytes used .
pub fn add(&mut self, data: &[u8]) -> Result<usize> {
        let mut consumed = 0;
        if self.header.is_none() {
            consumed += try!(self.read_header(data));
            if let Some(header) = self.header {
                self.expected = header.size as usize;
            }
        }
        if self.header.is_some() {
            consumed += self.read_body(&data[consumed..]);
        }
        Ok(consumed)
    }
pub fn add ( & mut self , data : & [ u8 ] ) -> Result < usize > { let mut consumed = 0 ; if self . header . is_none ( ) { consumed += try ! ( self read_header ( data ) ) ; if let Some ( header ) = self . header { self . expected = header . size as usize ; } } if self . header . is_some ( ) { consumed += self . read_body ( & data [ consumed .. ] ) ; } Ok ( consumed ) }
Process a new chunk of data and return the number of bytes used.
Process a new chunk of data and return the number of bytes used .
&mut self
data
&[u8]
&mut self
data
&[u8]