Fallout: docs, elided examples often elided too much.

This commit is contained in:
Niko Matsakis 2015-02-12 10:17:02 -05:00
parent d801a4da7c
commit ef42c2befd

View file

@ -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> {
/* ... */
}