3 ms·
Rust has Display: https://doc.rust-lang.org/std/fmt/trait.Display.html https://doc.rust-lang.org/std/fmt/trait.Display.html On the doc of ToString you can find
by simias 6y ago
Rust has Display: https://doc.rust-lang.org/std/fmt/trait.Display.html https://doc.rust-lang.org/std/fmt/trait.Display.html
On the doc of ToString you can find the following note:
>This trait is automatically implemented for any type which implements the Display trait. As such, ToString shouldn't be implemented directly: Display should be implemented instead, and you get the ToString implementation for free.
I think ToString exists mostly in order to have a more convenient API to get a String out of a display-able type, otherwise if you used Display directly you'd have to use a variant of that boilerplate every time: https://doc.rust-lang.org/src/alloc/string.rs.html#2185-2192 https://doc.rust-lang.org/src/alloc/string.rs.html#2185-2192