When to implement Display, FromStr, and ToString?

This statement resonates with me. I reach for these traits when there is only one obvious way to do it right. When the implementation involves some choices that might surprise a user, then I defer the implementation to a method on the type like MyT::to_custom_string or MyT::to_abbreviated().

You might also want to check out the previous discussion on ToString, FromStr and Display in this thread, at least I found it a good read :slight_smile: :

1 Like