Reputation: 319
To experiment with Hyper, I started with the GET example. Aside the fact that the example doesn't compile (no method `get` in `client`
) I have distilled my problem to a single line:
fn temp() {
let client = Client::new();
}
This code won't compile:
unable to infer enough type information about `_`; type annotations or generic parameter binding required [E0282]
Upvotes: 2
Views: 529
Reputation: 4891
In general this error would mean that Client
has some generic parameter and the compiler can not infer it's value. You would have to tell it somehow.
Here is example with 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
}
But hyper::client::Client
doesn't have any generic parameters. Are you sure the Client
you are trying to instantiate is the one from Hyper?
Upvotes: 4