Skip to content

Commit 4709c24

Browse files
author
Nick Hamann
committed
---
yaml --- r: 206846 b: refs/heads/beta c: 857a12a h: refs/heads/master v: v3
1 parent b769c26 commit 4709c24

File tree

107 files changed

+1128
-3707
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+1128
-3707
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3030
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3131
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
32-
refs/heads/beta: 222cd73b8a422d2c4124375f6aaffd2663bb9718
32+
refs/heads/beta: 857a12a01ed8a9249cea8f48b39a0f8bdfd95cbd
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3535
refs/heads/tmp: 579e31929feff51dcaf8d444648eff8de735f91a

branches/beta/AUTHORS.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,6 @@ Rob Hoelz <[email protected]>
736736
Robert Buonpastore <[email protected]>
737737
Robert Clipsham <[email protected]>
738738
Robert Gawdzik <[email protected]>
739-
Robert Foss <[email protected]>
740739
Robert Irelan <[email protected]>
741740
Robert Knight <[email protected]>
742741
Robert Millar <[email protected]>

branches/beta/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,9 @@ fetch snapshots, and an OS that can execute the available snapshot binaries.
8787

8888
Snapshot binaries are currently built and tested on several platforms:
8989

90-
| Platform \ Architecture | x86 | x86_64 |
91-
|--------------------------------|-----|--------|
92-
| Windows (7, 8, Server 2008 R2) |||
93-
| Linux (2.6.18 or later) |||
94-
| OSX (10.7 Lion or later) |||
90+
* Windows (7, 8, Server 2008 R2), x86 and x86-64 (64-bit support added in Rust 0.12.0)
91+
* Linux (2.6.18 or later, various distributions), x86 and x86-64
92+
* OSX 10.7 (Lion) or greater, x86 and x86-64
9593

9694
You may find that other platforms work, but these are our officially
9795
supported build environments that are most likely to work.

branches/beta/src/doc/reference.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,8 @@ vtable when the trait is used as a [trait object](#trait-objects).
13461346
Traits are implemented for specific types through separate
13471347
[implementations](#implementations).
13481348

1349+
Consider the following trait:
1350+
13491351
```
13501352
# type Surface = i32;
13511353
# type BoundingBox = i32;
@@ -1360,6 +1362,20 @@ This defines a trait with two methods. All values that have
13601362
`draw` and `bounding_box` methods called, using `value.bounding_box()`
13611363
[syntax](#method-call-expressions).
13621364

1365+
Traits can include default implementations of methods, as in:
1366+
1367+
```
1368+
trait Foo {
1369+
fn bar(&self);
1370+
1371+
fn baz(&self) { println!("We called baz."); }
1372+
}
1373+
```
1374+
1375+
Here the `baz` method has a default implementation, so types that implement
1376+
`Foo` need only implement `bar`. It is also possible for implementing types
1377+
to override a method that has a default implementation.
1378+
13631379
Type parameters can be specified for a trait to make it generic. These appear
13641380
after the trait name, using the same syntax used in [generic
13651381
functions](#generic-functions).
@@ -1372,6 +1388,30 @@ trait Seq<T> {
13721388
}
13731389
```
13741390

1391+
It is also possible to define associated types for a trait. Consider the
1392+
following example of a `Container` trait. Notice how the type is available
1393+
for use in the method signatures:
1394+
1395+
```
1396+
trait Container {
1397+
type E;
1398+
fn empty() -> Self;
1399+
fn insert(&mut self, Self::E);
1400+
}
1401+
```
1402+
1403+
In order for a type to implement this trait, it must not only provide
1404+
implementations for every method, but it must specify the type `E`. Here's
1405+
an implementation of `Container` for the standard library type `Vec`:
1406+
1407+
```
1408+
impl<T> Container for Vec<T> {
1409+
type E = T;
1410+
fn empty() -> Vec<T> { Vec::new() }
1411+
fn insert(&mut self, x: T) { self.push(x); }
1412+
}
1413+
```
1414+
13751415
Generic functions may use traits as _bounds_ on their type parameters. This
13761416
will have two effects: only types that have the trait may instantiate the
13771417
parameter, and within the generic function, the methods of the trait can be

branches/beta/src/doc/trpl/SUMMARY.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* [Hello, Cargo!](hello-cargo.md)
77
* [Learn Rust](learn-rust.md)
88
* [Guessing Game](guessing-game.md)
9-
* [Dining Philosophers](dining-philosophers.md)
10-
* [Rust inside other languages](rust-inside-other-languages.md)
119
* [Effective Rust](effective-rust.md)
1210
* [The Stack and the Heap](the-stack-and-the-heap.md)
1311
* [Testing](testing.md)
@@ -18,7 +16,6 @@
1816
* [Error Handling](error-handling.md)
1917
* [FFI](ffi.md)
2018
* [Borrow and AsRef](borrow-and-asref.md)
21-
* [Release Channels](release-channels.md)
2219
* [Syntax and Semantics](syntax-and-semantics.md)
2320
* [Variable Bindings](variable-bindings.md)
2421
* [Functions](functions.md)
@@ -31,9 +28,9 @@
3128
* [References and Borrowing](references-and-borrowing.md)
3229
* [Lifetimes](lifetimes.md)
3330
* [Mutability](mutability.md)
34-
* [Structs](structs.md)
3531
* [Enums](enums.md)
3632
* [Match](match.md)
33+
* [Structs](structs.md)
3734
* [Patterns](patterns.md)
3835
* [Method Syntax](method-syntax.md)
3936
* [Vectors](vectors.md)
@@ -47,6 +44,7 @@
4744
* [Universal Function Call Syntax](ufcs.md)
4845
* [Crates and Modules](crates-and-modules.md)
4946
* [`const` and `static`](const-and-static.md)
47+
* [Tuple Structs](tuple-structs.md)
5048
* [Attributes](attributes.md)
5149
* [`type` aliases](type-aliases.md)
5250
* [Casting between types](casting-between-types.md)

0 commit comments

Comments
 (0)