Into<String> better than AsRef<str>

This commit is contained in:
elvis
2025-06-17 17:25:42 +02:00
parent 7b4564cd60
commit d074812179

View File

@ -19,7 +19,11 @@ impl Translator {
} }
impl Translator { impl Translator {
pub fn convert<S: AsRef<str>>(&mut self, s: S) -> IdType { pub fn convert(&mut self, s: impl Into<String>) -> IdType {
*(self.strings.entry(s.as_ref().to_string()).or_insert({self.last_id += 1; self.last_id})) *(self.strings.entry(s.into()).or_insert(
{self.last_id += 1;
self.last_id
}
))
} }
} }