Created
May 15, 2015 16:12
-
-
Save unfo/98628bd48d2034a6d975 to your computer and use it in GitHub Desktop.
hyper client response does not implement read_to_string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate hyper; | |
use hyper::*; | |
fn main() { | |
let mut client = client::Client::new(); | |
let res = client.get("http://ip.nebula.fi/").send().unwrap(); | |
println!("Got response: {:?}", res.status_raw); | |
let mut contents = String::new(); | |
let body = try!(res.read_to_string(&mut contents)); | |
println!("Our ip: {:?}", contents); | |
} | |
// causes: | |
//src/main.rs:11:22: 11:51 error: type `hyper::client::response::Response` does not implement any method in scope named `read_to_string` | |
//src/main.rs:11 let body = try!(res.read_to_string(&mut contents)); | |
// ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
// vs http://hyper.rs/hyper/hyper/client/response/struct.Response.html | |
// has | |
// Trait Implementations | |
// | |
// impl Read for Response | |
// fn read(&mut self, buf: &mut [u8]) -> Result<usize> | |
// fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error> | |
// fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment