/// Returns the attributes str of this [`Class`].
fn gen_attributes_str(&self) -> String {
let mut astr = String::new();
for item in &self.attributes {
let attr_str = format!("private ${attrName}; \n", attrName = item.name);
astr.push_str(attr_str.as_str());
}
astr
}
就上面这段代码, 不知道为什么 astr.push_str()的操作只在第一次循环的时候有效,后面的循环都无法改变 astr 的值。