I have a trait
pub trait Reducer {
type Item;
fn reduce_all(&self) -> Self::Item
}
I have a concrete type
struct Counter {
amount: u32
}
I've implemented Reducer
for Vec<Counter>
like so:
impl<T: Borrow<Counter>> Reducer for Vec<T> {
type Item::Counter;
fn reduce_all(&self) -> Self::Item { ... implementation here ...}
}
Now I have a different concrete type
struct Statistic {
x_val: u32
}
and tried to also implement Reducer on Vec using the same technique:
impl<T: Borrow<SessionStat>> Reducer for Vec<T> {
...
but getting this error:
impl<T: Borrow<Counter>> Reducer for Vec<T> {
| ------------------------------------------- first implementation here
...
67 | impl<T: Borrow<SessionStat>> Reducer for Vec<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::vec::Vec<_>`
Not sure how to implement this trait twice for different vector contents