I have a trait like this:
trait Foo {
fn do_something(self) -> Self;
}
And I want implement this trait for a tuple that may have any number of elements that implement this trait.
impl<T> Foo for (T, T) where T: Foo {
fn do_something(self) -> Self {
let (t0, t1) = self;
(t0.do_something(), t1.do_something())
}
}
impl<T> Foo for (T, T, T) where T: Foo {
fn do_something(self) -> Self {
let (t0, t1, t2) = self;
(t0.do_something(), t1.do_something(), t2.do_something())
}
}
// and so on...