Use serde_json to persist cookies in the net crate

This commit is contained in:
Anthony Ramine 2017-02-22 12:33:10 +01:00
parent ec5ed8edfd
commit fd9cd33892
7 changed files with 45 additions and 27 deletions

View file

@ -16,7 +16,7 @@ use time::Tm;
extern crate time;
#[derive(Clone, Debug, RustcDecodable, RustcEncodable)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CookieStorage {
version: u32,
cookies_map: HashMap<String, Vec<Cookie>>,
@ -192,7 +192,7 @@ fn reg_host<'a>(url: &'a str) -> String {
fn is_cookie_expired(cookie: &Cookie) -> bool {
match cookie.expiry_time {
Some(t) => t.to_timespec() <= time::get_time(),
Some(ref t) => t.to_timespec() <= time::get_time(),
None => false,
}
}