I am trying to have the Data
struct implement the Main
(and the other two super traits). However, I cannot get it to work. It works fine if Super2
had no generic type. I tried impl
with generic without generic. Any help will be appreciated. Thank you.
trait Super1 {
fn super_fun1();
}
trait Super2<T> {
fn super_fun2(source: T);
}
trait Main<T>: Super1 + Super2<T> {
fn main_fun();
}
struct Data(f64);
impl Main for Data {
fn main_fun() {}
}
impl Super1 for Data {
fn super_fun1() {}
}
impl Super2<String> for Data {
fn super_fun2(source: String) {}
}
I tried placing in different places for Data implementation.
1