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

> Strings are a very common type, and so implement a _lot_ of these things, even when this kind of usecase may overlap.

I can't say this is very helpful; it's hard enough learning the one way. Why have `to_string()` if we have `into()`?



Well, one reason is that to_string() is ancient, but into() is fairly new. Another is that 'to' and 'into' are two different things: to_string() takes its caller by reference, and produces a copy. into() takes its caller by value, and so consumes it.




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

Search: