Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
chrismorgan
on May 30, 2019
|
parent
|
context
|
favorite
| on:
UTF-8 String Indexing Strategies
I’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
on May 30, 2019
|
next
[–]
It’s a bit of a footgun indeed but it’s quite handy in combination with the char index iterator.
chrismorgan
on May 30, 2019
|
parent
|
next
[–]
Sure, you do want to be able to index by code unit range, but it shouldn’t have been with the Index trait.
zucker42
on May 30, 2019
|
prev
[–]
There's no reason this couldn't be added now, though, right?
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: