reqwest::client не имеет метода get

Согласно этому примеру, я должен можно запустить get на клиенте, созданном с помощью построителя клиентов:

use reqwest::header;
let mut headers = header::Headers::new();
headers.set(header::Authorization("secret".to_string()));

// get a client builder
let client = reqwest::Client::builder()
    .default_headers(headers)
    .build()?;
let res = client.get("https://www.rust-lang.org").send()?;

Ниже приведен код, который я написал.

let client = Client::builder()
        .gzip(true)
        .timeout(Duration::from_secs(10))
        .build();
let resp = client.get("https://wiki.mozilla.org/images/f/ff/Example.json.gz");

Это ошибка, которую я получаю:

error[E0599]: no method named `get` found for type `std::result::Result<reqwest::Client, reqwest::Error>` in the current scope
  --> examples/gzipped_http_files.rs:86:23
   |
86 |     let resp = client.get("https://wiki.mozilla.org/images/f/ff/Example.json.gz");

Что я делаю не так?


person joydeep bhattacharjee    schedule 07.02.2019    source источник
comment
Вы забыли проверить результат, выходящий из .build(). Обратите внимание на оператор ? в исходном примере.   -  person E_net4 the curator    schedule 07.02.2019
comment
Или используйте .build().expect("Could not build the client") и т. д.   -  person Shepmaster    schedule 07.02.2019
comment
Это помогло мне пройти. Спасибо @E_net4   -  person joydeep bhattacharjee    schedule 07.02.2019