3 ms·
Rust's standard library String implements AddAssign, the effect of which is that the += operator exists, in effect a += b is sugar for AddAssign::add_assign(&mu
by tialaramex 4y ago
Rust's standard library String implements AddAssign, the effect of which is that the += operator exists, in effect a += b is sugar for AddAssign::add_assign(&mut a, b)
Personally I would rather it didn't, but the use of + as a concatenate operator is widespread and I imagine if String didn't do this a popular BetterString would.
No, the Rust for Linux String doesn't have push_str(), see for yourself: https://rust-for-linux.github.io/docs/alloc/string/struct.String.html https://rust-for-linux.github.io/docs/alloc/string/struct.St... that String also has no way to do infallible reserve(), and doesn't implement Write among other differences.