operator overloading
Making +, ==, or [] work for your own types.
Operators are method calls on std::ops and std::cmp traits (Add, Mul, Neg, Index, PartialEq...), so implementing the trait gives a type the operator.
Examples
impl Add for Money { type Output = Money; fn add(self, other: Money) -> Money { ... } }makesa + bwork for twoMoneyvalues.
See also