Skip to content

Link up some stuff in the vectors chapter #24515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/doc/trpl/vectors.md
Original file line number Diff line number Diff line change
@@ -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.)
Expand Down