pub fn name<T: Into<String>>(&mut self, name: T) -> &mut Self {
self.name = name.into().clone();
self
}
What I want is some way to have &str, &String enter in one fn and change a struct field called name.
Easiest way to do so I found was to implement Into, but reading documentation it says I should use From.
Here is the part I got stuck on, why should I not use Into?
I am quite new and the language they used went bit over my head and wondered if someone could help me understand and maybe implement the best/correct way of doing this ๐