Yes, although it looks like black magic.
You need to combine 3 bits of syntax:
- Type attribute accessibility is available through
<Type as Trait> - specifying
RHS just requires passing it as an Add<???> parameter - and finally, getting the associated attribute type just requires using
Trait::OutputType (which may be ambiguous)
Combining 3 together, we get <Self as Add<RhsType>>::Output .
source share