docs: update comments

This commit is contained in:
CarrotDLaw 2024-05-10 18:06:11 +08:00
parent 167a2928a5
commit af26bbc8ea
4 changed files with 6 additions and 6 deletions

View File

@ -78,8 +78,8 @@ fn main() {
print_util::print_array(&arr);
// 在 Rust 中,指定长度时([i32; 5])为数组
// 由于 Rust 的数组被设计为在编译期确定长度,因此只能使用常量来指定长度
// Vec 是 Rust 一般情况下使用动态数组的类型
// 为了方便实现扩容 extend() 方法,以下将 Vec 看作数组Array
// Vector 是 Rust 一般情况下用动态数组的类型
// 为了方便实现扩容 extend() 方法,以下将 vector 看作数组array
let nums: Vec<i32> = vec![1, 3, 2, 5, 4];
print!("\n数组 nums = ");
print_util::print_array(&nums);

View File

@ -96,7 +96,7 @@
let arr: [i32; 5] = [0; 5]; // [0, 0, 0, 0, 0]
// 在 Rust 中,指定长度时([i32; 5])为数组
// 由于 Rust 的数组被设计为在编译期确定长度,因此只能使用常量来指定长度
// Vector 是 Rust 一般情况下使用动态数组的类型
// Vector 是 Rust 一般情况下用动态数组的类型
// 为了方便实现扩容 extend() 方法,以下将 vector 看作数组array
let nums: Vec<i32> = vec![1, 3, 2, 5, 4];
```

View File

@ -78,8 +78,8 @@ fn main() {
print_util::print_array(&arr);
// 在 Rust 中,指定長度时([i32; 5])爲陣列,不指定長度時(&[i32])爲切片
// 由於 Rust 的陣列被設計為在編譯期確定長度,因此只能使用常數來指定長度
// Vec 是 Rust 一般情況下使用動態陣列的類型
// 為了方便實現擴容 extend() 方法,以下將 Vec 看作陣列Array
// Vector 是 Rust 一般情況下用動態陣列的類型
// 為了方便實現擴容 extend() 方法,以下將 vector 看作陣列array
let nums: Vec<i32> = vec![1, 3, 2, 5, 4];
print!("\n陣列 nums = ");
print_util::print_array(&nums);

View File

@ -97,7 +97,7 @@
let slice: &[i32] = [0; 5];
// 在 Rust 中,指定長度时([i32; 5])爲陣列,不指定長度時(&[i32])爲切片
// 由於 Rust 的陣列被設計為在編譯期確定長度,因此只能使用常數來指定長度
// Vector 是 Rust 一般情況下使用動態陣列的類型
// Vector 是 Rust 一般情況下用動態陣列的類型
// 為了方便實現擴容 extend() 方法,以下將 vector 看作陣列array
let nums: Vec<i32> = vec![1, 3, 2, 5, 4];
```