摘要: for循环 说明 for循环会消耗所有权 场景 行为 所有权 for item in collection 调用 .into_iter() 转移所有权(move) for item in &collection 调用 .iter() 不可变借用(&T) for item in &mut collec 阅读全文
posted @ 2026-01-30 11:19 lxd670 阅读(4) 评论(0) 推荐(0)
摘要: 条件判断 if判断 rust不会隐式的将数值转换布尔值 单分支if fn main() { let score = 85; if score >= 60 { println!("及格"); } } if加else fn main() { let score = 45; if score >= 60 阅读全文
posted @ 2026-01-30 00:46 lxd670 阅读(4) 评论(0) 推荐(0)