/// Send a given request and wait for response.
Send a given request and wait for response.
Send a given request and wait for response .
fn perform_request<H>(
        &mut self,
        request: &Request,
        rhandler: &mut H) -> Result<()> where H: 'static + ResponseHandler {
        let request = format!("{}", request)
            .into_bytes();
        try!(self.stream.write_all(&request));
        {
            let mut parser = ResponseParser::new(rhandler, 4096, 256);
            let mut buffer = [0u8; 4096];
            let mut length = try!(self.stream.read(&mut buffer));
            while length > 0 {
                if try!(parser.add(&buffer[..length])) {
                    length = try!(self.stream.read(&mut buffer));
                } else {
                    break;
                }
            }
        }
        rhandler.end();
        Ok(())
    }
fn perform_request < H > ( & mut self , request : & Request , rhandler : & mut H ) -> Result < ( ) > where H : ' static + ResponseHandler { let request = format ! ( " " request ) . into_bytes ( ) ; try ! ( self stream write_all ( request ) ) ; { let mut parser = ResponseParser :: new ( rhandler , 4096 , 256 ) ; let mut buffer = [ 0u8 ; 4096 ] ; let mut length = try ! ( self stream read ( mut buffer ) ) ; while length > 0 { if try ! ( parser add ( buffer [ length ] ) ) { length = try ! ( self stream read ( mut buffer ) ) ; } else { break ; } } } rhandler . end ( ) ; Ok ( ( ) ) }
Send a given request and wait for response.
Send a given request and wait for response .
&mut self
request
&Request
rhandler
&mut H