Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Rust's String requires allocation, but str (typically seen as the fat pointer type &str) does not. "The cat sat on the mat".split('a') is an iterator over sub-strings, no more allocation needed here than for 105u32.leading_zeros()

A lot of the Rust string API lives in str, not String.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: