Is overloading `=` possible in Rust?

I'm looking at https://doc.rust-lang.org/std/ops/index.html

I see AddAssign, MulAssign, ... but no Assign.

Is it possible to overload = in Rust ?

no, it is not possible to overload the assignment operator

5 Likes

Some good reasoning for why it's not possible is detailed in this thread: Why not an Assign trait?

6 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.