Suppose we have:
impl<T> Bar<T> {
...
}
ijpl<T: OtherT> Bar<T> {
... more functions ...
}
is there a way to combine this into a single impl of the form
impl<T> Bar<T> {
... normal stuff ...
{
.. additional stuff when T also satisfies OtherT ...
}
}
Each of the additional items can have more where T: ... constraints, but if you want to share that along many, you need a new impl block. Why do you want to avoid that?
You can put bounds on individual fns.
impl<T> Bar<T> {
fn additional_stuff() where T: OtherT {
}
}
No strong reason.
Mainly testing out aesthetic preferences regarding how things look / are blocked in code-folded mode in IntelliJ.
Sometimes a struct can have a clutter of 5-10 different 'impl' blocks for a single struct.