3 ms·
From my personal experience I think Rust's string system is hard to beat at the moment. It's pretty darn good from a usability point of view and it also found a
by the_mitsuhiko 7y ago
From my personal experience I think Rust's string system is hard to beat at the moment. It's pretty darn good from a usability point of view and it also found a nice solution to work with UCS2 windows APIs by providing a OsStr type.
- richardwhiuk 7y agoThe only annoyance is the occasional unwrap, when something is provably impossible, but the type system can't detect it.
- 1f60c 7y agoThat’s what `unwrap` is for, though.
- chrismorgan 7y agoI’m glad that Rust strings aren’t indexable by integer, but I think that making them indexable by range (of UTF-8 code unit offsets) was an error. `foo[0..10]` should have been `foo.slice(0..10)` or similar instead.
- the_mitsuhiko 7y agoIt’s a bit of a footgun indeed but it’s quite handy in combination with the char index iterator.
- chrismorgan 7y agoSure, you do want to be able to index by code unit range, but it shouldn’t have been with the Index trait.
- zucker42 7y agoThere's no reason this couldn't be added now, though, right?