Is it possible to call a generic function using a concrete type, with a concrete struct?
Here a small example of what I want to do:
trait T {}
trait T2 {}
struct S1 {}
struct S2 {}
impl T for S1 {}
impl T for S2 {}
fn test<V: T>(foo: &S1, bar: &S2, f: &Fn(&V)) {
f::<S1>(foo);
f(bar);
}
fn main() {
test(&S1{}, &S2{}, &|_| println!("called"));
}
I can't get rid of the generic parameter V
because the actual problem I want to solve is much more involved. Furthermore I can't create a wrapping trait, because sometimes I have got a weak signature and sometimes f
requires many more traits.