I thought the defacto way to convert an &str to String in Rust > 1.9.0 was using
toString(), but in a simple unit test verifying if a
Vec<String> contains something, I get:
method not found in
However, this works just fine, why is that?:
The method you are looking for is
to_string(), rather than
toString(). Rust normally names functions with snake_case.
I'm sorry - is it friday yet? And thank you!
ToString trait is in the prelude, so it isn't necessary to import it.
No worries! I'm actually surprised that the error message didn't help you out here, so I filed
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.