s
sander
46 Joined 5 days ago
Should I write string function arguments as &str, String, AsRef<str>, or Into<String> in Rust?

I'm developing a public Rust library and I'm unsure how to handle function parameters that deal with strings. There seem to be multiple idiomatic options: - &str - String - impl AsRef<str> - impl Into<String> Each of these works in different cases, but I don't u...

2 votes 15 views 1 Answer Asked 5 days ago