Why does refactoring by extracting a method trigger a borrow checker error?
问题 The architecture of my networking application can be stripped down to the following: use std::collections::HashMap; /// Represents remote user. Usually has fields, /// but we omit them for the sake of example. struct User; impl User { /// Send data to remote user. fn send(&mut self, data: &str) { println!("Sending data to user: \"{}\"", data); } } /// A service that handles user data. /// Usually has non-trivial internal state, but we omit it here. struct UserHandler { users: HashMap<i32,