AssociatedTypes and function type constraints

I have a trait object with an associated type

pub trait ProvideValue {
    type Lookup: ToString;
    fn value(&self, key: &Self::Lookup) -> String;

And a function which I am defining like so:

fn display_table<T,V>(keys: Vec<T>,json: Vec<V> )
where T: ToString,
          V: ProvideValue { ... }

T in addition to needing to implement ToString also needs to be the associated type Lookup for V. How do I express this?
I am getting the following error in the implementation of display_table

error: expected identifier, found `<`
  --> src/
39 | where T: <V as foobar::ProvideValue>::Lookup+ToString,
   |          ^ expected identifier


1 Like

V: ProvideValue<Lookup = T>

1 Like

thats exactly what I was looking for. Thanks!