#![feature(custom_derive, plugin)] #![plugin(serde_macros)] extern crate ease; use std::collections::HashMap; use ease::{Url, Request}; #[derive(Deserialize, Debug)] struct Response { args: HashMap, data: Option, files: Option>, form: Option>, headers: HashMap, json: Option, origin: String, url: String, } fn main() { let url = Url::parse("http://httpbin.org/post").unwrap(); println!("{:#?}", Request::new(url).post().and_then(|res| res.from_json::())); let url = Url::parse("http://httpbin.org/get").unwrap(); println!("{:#?}", Request::new(url).get().and_then(|res| res.from_json::())); }