Why FromStr is needed if we have TryFrom?

37 points meownoid

I'm learning Rust and it is great, but there are some things which I don't understand. I tried googling them, but did not find answers. Maybe you could help me to understand the language better.

So, one of these things is why do we need FromStr and parse method when we have more generic TryFrom and try_into method?

I was just playing with Rust and I needed to convert string to number and I remembered that I've read about the From interface in the tutorial. Ok, but conversion may fail, so I should really use the TryFrom interface. I tried and it didn't work. After googling I found out that there is FromStr which is exactly the same as TryFrom but with string hardcoded as a first parameter. I really don't understand why this is needed.