fn header_as_datetime(name: &str, resp: &reqwest::blocking::Response) -> Result<DateTime<Utc>> {
    let header = resp.headers()
                     .get(name)
                     .ok_or_else(|| Error::from(format!("Response missing the {} header", name)))?
                     .to_str()?;

    let timestamp = DateTime::parse_from_rfc2822(header).chain_err(|| {
                                                            format!("Could not parse {} header",
                                                                    name)
                                                        })?;
    let utc_timestamp = timestamp.with_timezone(&Utc);

    Ok(utc_timestamp)
}
/// Try to return an arbitrary header as UTC datetime
Try to return an arbitrary header as UTC datetime
Try to return an arbitrary header as UTC datetime
fn header_as_datetime(name: &str, resp: &reqwest::blocking::Response) -> Result<DateTime<Utc>> {
    let header = resp.headers()
                     .get(name)
                     .ok_or_else(|| Error::from(format!("Response missing the {} header", name)))?
                     .to_str()?;
    let timestamp = DateTime::parse_from_rfc2822(header).chain_err(|| {
                                                            format!("Could not parse {} header",
                                                                    name)
                                                        })?;
    let utc_timestamp = timestamp.with_timezone(&Utc);
    Ok(utc_timestamp)
}
fn header_as_datetime ( name : & str , resp : & reqwest :: blocking :: Response ) -> Result < DateTime < Utc > > { let header = resp . headers ( ) . get ( name ) . ok_or_else ( | | Error :: from ( format ! ( " " name ) ) ) ? . to_str ( ) ? ; let timestamp = DateTime :: parse_from_rfc2822 ( header ) . chain_err ( | | { format ! ( " " name ) } ) ? ; let utc_timestamp = timestamp . with_timezone ( & Utc ) ; Ok ( utc_timestamp ) }
Try to return an arbitrary header as UTC datetime
Try to return an arbitrary header as UTC datetime
name
&str
resp
&reqwest::blocking::Response
name
&str
resp
&reqwest::blocking::Response