Rollup merge of #24515 - steveklabnik:gh24070, r=Gankro
Fixes #24070 or rather, fixes it even though it's already been fixed: slices are before now. But the linking is nice anyway.
This commit is contained in:
commit
1b6bd92790
@ -1,13 +1,18 @@
|
||||
% Vectors
|
||||
|
||||
A *vector* is a dynamic or "growable" array, implemented as the standard
|
||||
library type [`Vec<T>`](../std/vec/) (Where `<T>` is a [Generic](./generics.md) statement). Vectors always allocate their data on the heap. Vectors are to slices
|
||||
what `String` is to `&str`. You can create them with the `vec!` macro:
|
||||
library type [`Vec<T>`](../std/vec/) (Where `<T>` is a [Generic](./generics.md)
|
||||
statement). Vectors always allocate their data on the heap. Vectors are to
|
||||
[slices][slices] what [`String`][string] is to `&str`. You can
|
||||
create them with the `vec!` macro:
|
||||
|
||||
```{rust}
|
||||
let v = vec![1, 2, 3]; // v: Vec<i32>
|
||||
```
|
||||
|
||||
[slices]: primitive-types.html#slices
|
||||
[string]: strings.html
|
||||
|
||||
(Notice that unlike the `println!` macro we've used in the past, we use square
|
||||
brackets `[]` with `vec!`. Rust allows you to use either in either situation,
|
||||
this is just convention.)
|
||||
|
Loading…
x
Reference in New Issue
Block a user