Considering the following code:
let s = String::from("hello");
let mut r = String::new();
for c in s.chars() {
r.push(c);
}
As chars
is the method of &str
, why can String
call it? I suppose it has something to do with the coercion
, but I don't fully understand this implicit conversion.