2024-06-15 23:48:04 +08:00

12 lines
814 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 向量
向量是 Rust 中使用最廣泛的資料結構之一。在其他程式語言中,它們可能被簡單地稱為數組,但由於 Rust 操作的是較低層次的數據,數組在 Rust 中是存儲在棧上的stack意味著它不能增長或縮小大小需要在編譯時知道而向量是存儲在堆上的heap這些限制不適用
向量在書中屬於稍後的章節,但我們認為它們足夠有用,值得提前介紹。我們將在後面討論另一個有用的資料結構:雜湊表。
## 進一步了解
- [使用向量存儲值列表](https://doc.rust-lang.org/stable/book/ch08-01-vectors.html)
- [`iter_mut`](https://doc.rust-lang.org/std/primitive.slice.html#method.iter_mut)
- [`map`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.map)