をこのエラーが意味するであろう例は、私は、単一の行に私の問題を蒸留している(no method `get` in `client`
)をコンパイルしないことを除けば事実Client
にはいくつかの汎用パラメータがあり、コンパイラはその値を推論できません。あなたは何とかそれを伝える必要があります。ここで
はstd::vec::Vec
と例です。
use std::vec::Vec;
fn problem() {
let v = Vec::new(); // Problem, which Vec<???> do you want?
}
fn solution_1() {
let mut v = Vec::<i32>::new(); // Tell the compiler directly
}
fn solution_2() {
let mut v: Vec<i32> = Vec::new(); // Tell the compiler by specifying the type
}
fn solution_3() {
let mut v = Vec::new();
v.push(1); // Tell the compiler by using it
}
しかしhyper::client::Client
は、任意の一般的なパラメータはありません。あなたはインスタンス化しようとしているClient
がHyperからのものであると確信していますか?
私はこれを自分で試しましたが、エラーを再現できませんでした。あなたのファイルに 'extern crate hyper;'と 'use hyper :: Client;'がありますか?ここに私の作業バージョンがあります:http://play.integer32.com/?gist=4debd4812508baf255f21715fbf44ef0 –
私のmain.rs.にあなたのコードを貼り付けました。同じエラー –
私がhyper-repoからhyperを使用すると、これをコンパイルします。 hyper = {git = "https://github.com/hyperium/hyper"} これはコンパイルされません。それはおそらく理由を説明します... –