I was trying to understand what's going on when reading a line, but I couldn't find that there is a method to_string
in the documentation for str, even though I know it's there.
There is no direct link between &str
and ToString::to_string
in the docs because ToString
has a blanket implementation:
impl<T> ToString for T where T: Display, T: ?Sized
This means that ToString
is implemented for any item that implements Display
. &str
does implement Display
.
(Moved from a comment).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With