fn guess_encoding(response: &Response) -> &'static Encoding {
    let content_type = response
        .headers()
        .get(CONTENT_TYPE)
        .and_then(|value| value.to_str().ok())
        .and_then(|value| value.parse::<Mime>().ok());
    let encoding_name = content_type
        .as_ref()
        .and_then(|mime| mime.get_param("charset").map(|charset| charset.as_str()))
        .unwrap_or("utf-8");
    Encoding::for_label(encoding_name.as_bytes()).unwrap_or(UTF_8)
}
/// Guess the response's encoding, with UTF-8 as the default.
///
/// reqwest doesn't provide an API for this, so the logic is copied here.
///
/// See https://github.com/seanmonstar/reqwest/blob/2940740493/src/async_impl/response.rs#L172
Guess the response's encoding, with UTF-8 as the default.
reqwest doesn't provide an API for this, so the logic is copied here.


Guess the response ' s encoding with UTF - 8 as the default . reqwest doesn ' t provide an API for this so the logic is copied here .
fn guess_encoding(response: &Response) -> &'static Encoding {
    let content_type = response
        .headers()
        .get(CONTENT_TYPE)
        .and_then(|value| value.to_str().ok())
        .and_then(|value| value.parse::<Mime>().ok());
    let encoding_name = content_type
        .as_ref()
        .and_then(|mime| mime.get_param("charset").map(|charset| charset.as_str()))
        .unwrap_or("utf-8");
    Encoding::for_label(encoding_name.as_bytes()).unwrap_or(UTF_8)
}
fn guess_encoding ( response : & Response ) -> & ' static Encoding { let content_type = response . headers ( ) . get ( CONTENT_TYPE ) . and_then ( | value | value . to_str ( ) . ok ( ) ) . and_then ( | value | value . parse :: < Mime > ( ) . ok ( ) ) ; let encoding_name = content_type . as_ref ( ) . and_then ( | mime | mime . get_param ( " " ) . map ( | charset | charset . as_str ( ) ) ) . unwrap_or ( " " ) ; Encoding :: for_label ( encoding_name . as_bytes ( ) ) . unwrap_or ( UTF_8 ) }
Guess the response's encoding, with UTF-8 as the default.
Guess the response ' s encoding with UTF - 8 as the default .
response
&Response
response
&Response