chore: 初始化 Rust 第五部分学习项目

添加了 part5 项目的 Cargo 配置、示例代码和 Rust 枚举练习题文档
This commit is contained in:
Yuhang Wu 2026-07-14 16:51:17 +08:00
parent 5cad182723
commit 7efa839f7a
5 changed files with 1532 additions and 0 deletions

View File

@ -0,0 +1,7 @@
---
alwaysApply: true
scene: git_message
language: zh-CN
---
在此处编写规则,自定义 AI 生成提交信息的风格。

7
part5/Cargo.lock generated Normal file
View File

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "part5"
version = "0.1.0"

6
part5/Cargo.toml Normal file
View File

@ -0,0 +1,6 @@
[package]
name = "part5"
version = "0.1.0"
edition = "2024"
[dependencies]

1493
part5/enum练习题.md Normal file

File diff suppressed because it is too large Load Diff

19
part5/src/main.rs Normal file
View File

@ -0,0 +1,19 @@
#[derive(Debug)]
enum Direction {
North,
South,
East,
West,
}
enum IpAddr {
V4(String),
V6(String),
}
fn main() {
let direction = Direction::North;
println!(" direction: {:?}", direction);
let home = IpAddr::V4(String::from("127.0.0.1"));
// println!(" home: {:?}", home);
}