Answer the question
In order to leave comments, you need to log in
How to use the moved value?
I'm trying to do something like this:
let mut people = HashMap::new();
for a in 0..10 {
for b in 0..10 {
let id = format!("{}-{}", a, b);
people.insert(id, Person::new(id));
}
}
Answer the question
In order to leave comments, you need to log in
Use a copy of a string?
people.insert(id.clone(), Person::new(id.clone()))
Perhaps one clone() is enough - I'm just learning rust myself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question