Implement one trait for multiple structs at once

Viewed 1904

I have trait FooTrait which has a bunch of functions. I also have structs FooStruct and BarStruct and want to implement FooTrait for both structs with the methods doing exactly the same.

Is there a way to implement FooTrait for both FooStruct and BarStruct at once? I imagined something like the following:

impl FooTrait for FooStruct + BarStruct {
    // implement methods here
}
1 Answers
Related