Hi I want to ask something about common conversion traits which I find helpful but little confusing in Rust
Mainly it's about
Display, etc. as converting from/to
String is quite common
what's difference between
FromStr? which one should I impl for my custom type ?
From<String>, I automatically have
Into<String>, this is good.
But by impl
Display, I also have a
to_string()method whose name also suggests a conversion into String, which one should I use?
I have seen many librarys impl raw methods like
into_u8as conversion method, which ignores all above utility. Is this simply history reason and we should try not doing so?
There are many other scenarios which make me confusing
Generally, if all these looking-similiar traits should manually be impled identically, why does rust have them each?
Or if they have difference semantics and use cases, what's that and why does they have seemingly un-distinguishable method name ?
Thanks in advance!