diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2015-02-12 10:17:02 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2015-02-18 10:25:13 -0500 |
| commit | ef42c2befd9451cd913de60539487a483ae9deac (patch) | |
| tree | 4715abed4941f955ba2c9c6e108cce09956bb543 /src | |
| parent | d801a4da7cc8672c3b7655ccad218ab892b8dd9b (diff) | |
| download | rust-ef42c2befd9451cd913de60539487a483ae9deac.tar.gz rust-ef42c2befd9451cd913de60539487a483ae9deac.zip | |
Fallout: docs, elided examples often elided too much.
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/reference.md | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md index 00ed5d4562b..0d65c971804 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -576,7 +576,7 @@ the final namespace qualifier is omitted. Two examples of paths with type arguments: ``` -# struct HashMap<K, V>; +# struct HashMap<K, V>(K,V); # fn f() { # fn id<T>(t: T) -> T { t } type T = HashMap<i32,String>; // Type arguments used in a type expression @@ -1603,7 +1603,7 @@ pointer values (pointing to a type for which an implementation of the given trait is in scope) to pointers to the trait name, used as a type. ``` -# trait Shape { } +# trait Shape { fn dummy(&self) { } } # impl Shape for i32 { } # let mycircle = 0i32; let myshape: Box<Shape> = Box::new(mycircle) as Box<Shape>; @@ -1634,8 +1634,8 @@ let x: f64 = Num::from_i32(42); Traits may inherit from other traits. For example, in ``` -trait Shape { fn area() -> f64; } -trait Circle : Shape { fn radius() -> f64; } +trait Shape { fn area(&self) -> f64; } +trait Circle : Shape { fn radius(&self) -> f64; } ``` the syntax `Circle : Shape` means that types that implement `Circle` must also @@ -1729,7 +1729,7 @@ type parameters taken by the trait it implements. Implementation parameters are written after the `impl` keyword. ``` -# trait Seq<T> { } +# trait Seq<T> { fn dummy(&self, _: T) { } } impl<T> Seq<T> for Vec<T> { /* ... */ } |
