File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -2686,8 +2686,8 @@ fn add(x: int, y: int) -> int {
2686
2686
2687
2687
let mut x = add(5,7);
2688
2688
2689
- type binop = fn(int,int) -> int;
2690
- let bo: binop = add;
2689
+ type Binop = fn(int,int) -> int;
2690
+ let bo: Binop = add;
2691
2691
x = bo(5,7);
2692
2692
~~~~~~~~
2693
2693
@@ -2697,24 +2697,24 @@ Every trait item (see [traits](#traits)) defines a type with the same name
2697
2697
as the trait. For a trait ` T ` , cast expressions introduce values of type ` T ` :
2698
2698
2699
2699
~~~~~~~~
2700
- trait printable {
2700
+ trait Printable {
2701
2701
fn to_str() -> ~str;
2702
2702
}
2703
2703
2704
- impl ~str: printable {
2704
+ impl ~str: Printable {
2705
2705
fn to_str() -> ~str { self }
2706
2706
}
2707
2707
2708
- fn print(a: printable ) {
2708
+ fn print(a: Printable ) {
2709
2709
io::println(a.to_str());
2710
2710
}
2711
2711
2712
2712
fn main() {
2713
- print(~"meow" as printable );
2713
+ print(~"meow" as ~Printable );
2714
2714
}
2715
2715
~~~~~~~~
2716
2716
2717
- In this example, the trait ` printable ` occurs as a type in both the type signature of
2717
+ In this example, the trait ` Printable ` occurs as a type in both the type signature of
2718
2718
` print ` , and the cast expression in ` main ` .
2719
2719
2720
2720
### Type parameters
@@ -2740,16 +2740,16 @@ impl item. It refers to the type of the implicit `self` argument. For
2740
2740
example, in:
2741
2741
2742
2742
~~~~~~
2743
- trait printable {
2743
+ trait Printable {
2744
2744
fn to_str() -> ~str;
2745
2745
}
2746
2746
2747
- impl ~str: printable {
2747
+ impl ~str: Printable {
2748
2748
fn to_str() -> ~str { self }
2749
2749
}
2750
2750
~~~~~~
2751
2751
2752
- ` self ` refers to the value of type ` str ` that is the receiver for a
2752
+ ` self ` refers to the value of type ` ~ str` that is the receiver for a
2753
2753
call to the method ` to_str ` .
2754
2754
2755
2755
## Type kinds
You can’t perform that action at this time.
0 commit comments