4 ms·
No, no, Rust has unicode (utf8) strings (also bytestrings if you need them). "bytes" was a mischaracterization, sorry. I'm saying that most string handling in
by Manishearth 10y ago
No, no, Rust has unicode (utf8) strings (also bytestrings if you need them). "bytes" was a mischaracterization, sorry.
I'm saying that most string handling in Rust is just lugging them around and copying them and concatenating/interpolating them.
On top of that, the few times you do iterate through them, you're looking for specific characters or character sequences (e.g. while parsing), and EGCs aren't so important there. They can be, but usually aren't.
Basically, personally the only times I've seen .chars() being used is in parsery things (where your grammar is defined over code points, not EGCs, so using EGCs is counterproductive and wrong), in the Servo DOM (where the spec tells you to operate on chars), and code where you're just verifying that the string contains or does not contain code points of a certain type (e.g. whitespace).
None of this is ascribing meaning to the concept of a code point, it's just using them as a crutch to reason about things like equality. (Of course, equality in Unicode is a whole other can of worms).