3 ms·
> At the most basic level, in Rust you cannot overload operators. I've heard this claim multiple places and I don't really understand it. Operators have corres
by jamincan 4y ago
> At the most basic level, in Rust you cannot overload operators.
I've heard this claim multiple places and I don't really understand it. Operators have corresponding traits that you can pretty easily define for your types.
https://doc.rust-lang.org/std/ops/index.html#traits https://doc.rust-lang.org/std/ops/index.html#traits
- Ygg2 4y agoMy reading is that Rust doesn't allow overloading of constructors (don't exist as such) or assignments or whatever is actually needed for copying move constructors.