Skip to content

Clarification: Use Slice instead of Array #14102

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
May 11, 2014
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
6 changes: 3 additions & 3 deletions src/doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -2385,7 +2385,7 @@ fn print_all<T: Printable>(printable_things: ~[T]) {
Declaring `T` as conforming to the `Printable` trait (as we earlier
did with `Clone`) makes it possible to call methods from that trait
on values of type `T` inside the function. It will also cause a
compile-time error when anyone tries to call `print_all` on an array
compile-time error when anyone tries to call `print_all` on a vector
whose element type does not have a `Printable` implementation.

Type parameters can have multiple bounds by separating them with `+`,
Expand Down Expand Up @@ -2428,9 +2428,9 @@ fn draw_all<T: Drawable>(shapes: ~[T]) {
# draw_all(~[c]);
~~~~

You can call that on an array of circles, or an array of rectangles
You can call that on a vector of circles, or a vector of rectangles
(assuming those have suitable `Drawable` traits defined), but not on
an array containing both circles and rectangles. When such behavior is
a vector containing both circles and rectangles. When such behavior is
needed, a trait name can alternately be used as a type, called
an _object_.

Expand Down