diff options
| author | moonglum <moonglum@moonbeamlabs.com> | 2014-05-10 17:16:47 -0700 |
|---|---|---|
| committer | moonglum <moonglum@moonbeamlabs.com> | 2014-05-10 18:02:02 -0700 |
| commit | 1895ad269ca7d4c8a258fb6188fac5f1d97c55ff (patch) | |
| tree | 4971453e7c5f05bf50f16a0337551e59555ea261 /src/doc/tutorial.md | |
| parent | 1001635dc1be7ee7c42800e7e2e537a811280c8a (diff) | |
| download | rust-1895ad269ca7d4c8a258fb6188fac5f1d97c55ff.tar.gz rust-1895ad269ca7d4c8a258fb6188fac5f1d97c55ff.zip | |
Clarification of Slice, Vector and Array
Especially in the tutorial beginners should not be confused with wrong terminology. It helps to know the right names for things when you want to find something in the documentation.
Diffstat (limited to 'src/doc/tutorial.md')
| -rw-r--r-- | src/doc/tutorial.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index 9b9153fe579..b7122944ced 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -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 `+`, @@ -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_. |
