derive_more icon indicating copy to clipboard operation
derive_more copied to clipboard

Derive both regular and forward Mul

Open SuperSamus opened this issue 4 years ago • 2 comments

If you #[derive(Mul)] (or MulAssign) on a struct, it will implement the multiplication with a primitive type, but not with a struct of the same type. If you add #[mul(forward)] it's going to be the opposite: it's implemented for the struct of the same type but not for a primitive type. There is no way to have both of them on the same struct (or if there is it's not well documented because I couldn't find it).

For example, on a Vec3 struct it might be useful to multiply all of its components by the same amount or to multiply separately by a different amount. But right now this crate can only implement one of these.

SuperSamus avatar Jul 02 '21 19:07 SuperSamus

I still have this issue. Is it solved?

Rohithcheryala avatar Jun 22 '22 11:06 Rohithcheryala

Makes sense to me. That's indeed a missing feature curretly afaict. PRs welcome.

JelteF avatar Dec 21 '23 23:12 JelteF