A str in rust is an utf8 string, to quote the docs ‘String slices are always valid utf8’. But using get or [] on a str might yield invalid utf8 and panic the program because they use byte indexes not char indexes. WTF @rustlang ?!?
-
-
This returns an Option, which you can then handle yourself
-
Thanks, that seems way more reasonable!
- 2 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.