I got "the trait bound is not satisfied" error but can't understand why.
This is a trait implementation
pub struct QueryParser<T> {
indexes: Vec<String>,
phantom: PhantomData<T>,
}
impl<'a, T> BeforeMiddleware for QueryParser<T>
where
T: QueryKey + Send + Sync,
<T as Key>::Value: Query + DeserializeOwned,
{
fn before(&self, request: &mut Request) -> IronResult<()> {
...
...
}
}
And this is it usage
chain.link_before(QueryParser::<FilterKey>::new(&cfg.indexes));
And this is error
error[E0277]: the trait bound `query_parser::QueryParser<list::filter::FilterKey>: iron::middleware::BeforeMiddleware` is not satisfied
--> src/main.rs:33:23
|
33 | chain.link_before(QueryParser::<FilterKey>::new(&cfg.indexes));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `iron::middleware::BeforeMiddleware` is not implemented for `query_parser::QueryParser<list::filter::FilterKey>`
|
= help: the following implementations were found:
<query_parser::QueryParser<T> as iron::middleware::BeforeMiddleware>
Compiler even say than "the following implementations were found". What's wrong?????