摘要: 【Rust】枚举 enum 阅读全文
posted @ 2022-01-13 21:05 翠微 阅读(39) 评论(0) 推荐(0) 编辑
摘要: 定义结构体 #[derive(Debug)] struct Rectangle { name: String, width: u32, height: u32, } 定义结构体方法 impl Rectangle { // 方法 fn area(&self) -> u32 { self.width * 阅读全文
posted @ 2022-01-13 21:04 翠微 阅读(168) 评论(0) 推荐(0) 编辑