Today we are taking a look at fundamental data structure in computer science, Vectors. Vectors play a crucial role in various programming tasks in Rust. A system programming language like rust is known for its emphasis on safety and performance, hence vectors offer some powerful capabilities for managing dynamic collections of data.
今天我们来看看计算机科学中的基本数据结构,向量。向量在Rust中的各种编程任务中起着至关重要的作用。像rust这样的系统编程语言以强调安全性和性能而闻名,因此vectors提供了一些强大的功能来管理动态数据集合。
Introduction 介绍
In rust, vectors are a part of the standard library and can be denoted by Vec<T>
. Unlike arrays, vectors are dynamic in size.
在rust中,vector是标准库的一部分,可以用 Vec<T>
表示。与数组不同,向量的大小是动态的。
Vectors can grow and shrink as needed, making them a versatile option for handling collection of elements whose size may change during runtime.
向量可以根据需要增长和收缩,使其成为