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 ?!?
-
-
Thanks, that seems way more reasonable!
-
Basically never use [] on a string always use get
- 1 more reply
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.