2 unstable releases
Uses old Rust 2015
0.2.0 | Dec 16, 2016 |
---|---|
0.1.0 | Dec 13, 2016 |
#174 in #asynchronous
19KB
437 lines
async-http-client
Asynchronous HTTP client.
Use async-http-client
In your Cargo.toml, add:
[dependencies]
async-http-client = "0.2"
License
MIT
lib.rs
:
Asynchronous HTTP client.
Installation
Add this to your Cargo.toml
:
[dependencies]
async-http-client = "0.2"
Example
extern crate async_http_client;
use async_http_client::prelude::*;
use async_http_client::{HttpRequest, HttpCodec};
let req = HttpRequest::get("http://www.google.com").unwrap();
let mut core = Core::new().unwrap();
let addr = req.addr().unwrap();
let handle = core.handle();
let (res, framed) = core.run(TcpStream::connect(&addr, &handle).and_then(|connection| {
let framed = connection.framed(HttpCodec::new());
req.send(framed)
})).unwrap();
println!("got response {}", res.unwrap());
Dependencies
~8.5MB
~153K SLoC