Skip to content

Commit b5f6916

Browse files
committed
Release of Rust-0.10
1 parent a226d85 commit b5f6916

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ before_install:
55
- yes | sudo add-apt-repository ppa:hansjorg/rust
66
- sudo apt-get update
77
install:
8-
- sudo apt-get install rust-nightly
8+
- sudo apt-get install rust-0.10
99
- rustc --version
1010
script:
1111
- make clean test

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ rust-examples [![Ohloh statistics](http://www.ohloh.net/p/rust-examples/widgets/
77
gather example codes from tutorial and other documentations of
88
[Rust](http://www.rust-lang.org/) into files, ready to compile.
99

10-
Examples are tested with version 0.10-pre.
10+
Examples are tested with version 0.10.
1111

1212
## Files
1313

1414
* [Homepage](http://www.rust-lang.org/)
15-
* `what_it_looks_like.rs`
15+
* `what_it_looks_like.rs`, `what_it_looks_like2.rs`
1616
* [Tutorial]
1717
* [2.1](http://static.rust-lang.org/doc/master/tutorial.html#compiling-your-first-program) Compiling your first program: `tutorial-02_1-hello.rs`
1818
* [3](http://static.rust-lang.org/doc/master/tutorial.html#syntax-basics) Syntax basics: `tutorial-03-syntax_basics.rs`

tutorial-04_2-pattern-matching.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn angle(vector: (f64, f64)) -> f64 {
2020
match vector {
2121
(0.0, y) if y < 0.0 => 1.5 * pi,
2222
(0.0, _) => 0.5 * pi,
23-
(x, y) => atan(y / x)
23+
(x, y) => (y / x).atan()
2424
}
2525
}
2626
fn main() {

what_it_looks_like2.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//! Example given on the homepage (2014-04-03) http://www.rust-lang.org/
2+
//!
3+
//! @license MIT license <http://www.opensource.org/licenses/mit-license.php>
4+
fn main() {
5+
// A simple integer calculator:
6+
// `+` or `-` means add/sub by 1
7+
// `*` or `/` means mul/div by 2
8+
9+
let program = "+ + * - /";
10+
let mut accumulator = 0;
11+
12+
for token in program.chars() {
13+
match token {
14+
'+' => accumulator += 1,
15+
'-' => accumulator -= 1,
16+
'*' => accumulator *= 2,
17+
'/' => accumulator /= 2,
18+
_ => { /* ignore everything else */ }
19+
}
20+
}
21+
22+
println!("The program \"{}\" calculates the value {}",
23+
program, accumulator);
24+
}

0 commit comments

Comments
 (0)