Skip to content

Commit 4e12f42

Browse files
committed
---
yaml --- r: 128719 b: refs/heads/try c: 21a70b3 h: refs/heads/master i: 128717: bd658b2 128715: 0cf32a0 128711: 9473c59 128703: ceb5f01 v: v3
1 parent e94ad2c commit 4e12f42

File tree

4 files changed

+15
-80
lines changed

4 files changed

+15
-80
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 07d86b46a949a94223da714e35b343243e4ecce4
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a86d9ad15e339ab343a12513f9c90556f677b9ca
5-
refs/heads/try: 15833d91acc65895d4cfd0949ab24e9c71e6e48c
5+
refs/heads/try: 21a70b38ba8aa3b50959c1b9f573391c7692611b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ documentation.
3232

3333
To build from the [tarball] do:
3434

35-
$ curl -O http://static.rust-lang.org/dist/rust-nightly.tar.gz
35+
$ curl -O https://static.rust-lang.org/dist/rust-nightly.tar.gz
3636
$ tar -xzf rust-nightly.tar.gz
3737
$ cd rust-nightly
3838

@@ -75,7 +75,7 @@ To easily build on windows we can use [MSYS2](http://sourceforge.net/projects/ms
7575
$ make && make install
7676

7777
[repo]: https://github.com/rust-lang/rust
78-
[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz
78+
[tarball]: https://static.rust-lang.org/dist/rust-nightly.tar.gz
7979
[tutorial]: http://doc.rust-lang.org/tutorial.html
8080

8181
## Notes

branches/try/src/doc/guide.md

Lines changed: 9 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ Linux or a Mac, all you need to do is this (note that you don't need to type
3232
in the `$`s, they just indicate the start of each command):
3333

3434
```{ignore}
35-
$ curl -s http://www.rust-lang.org/rustup.sh | sudo sh
35+
$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh
3636
```
3737

3838
(If you're concerned about `curl | sudo sh`, please keep reading. Disclaimer
3939
below.)
4040

4141
If you're on Windows, please [download this .exe and run
42-
it](http://static.rust-lang.org/dist/rust-nightly-install.exe).
42+
it](https://static.rust-lang.org/dist/rust-nightly-install.exe).
4343

4444
If you decide you don't want Rust anymore, we'll be a bit sad, but that's okay.
4545
Not every programming language is great for everyone. Just pass an argument to
4646
the script:
4747

4848
```{ignore}
49-
$ curl -s http://www.rust-lang.org/rustup.sh | sudo sh -s -- --uninstall
49+
$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh -s -- --uninstall
5050
```
5151

5252
If you used the Windows installer, just re-run the `.exe` and it will give you
@@ -1341,7 +1341,7 @@ computer science: naming things, cache invalidation, and off-by-one errors."
13411341
The joke, of course, being that the setup says "two hard problems" but then
13421342
lists three things. This happens quite a bit with "C style" `for` loops.
13431343

1344-
We'll talk more about `for` when we cover **iterator**s, later in the Guide.
1344+
We'll talk more about `for` when we cover **vector**s, later in the Guide.
13451345

13461346
## `while`
13471347

@@ -1427,6 +1427,11 @@ for x in range(0i, 10i) {
14271427

14281428
Both `continue` and `break` are valid in both kinds of loops.
14291429

1430+
We have now learned all of the most basic Rust concepts. We're ready to start
1431+
building our guessing game, but we need to know how to do one last thing first:
1432+
get input from the keyboard. You can't have a guessing game without the ability
1433+
to guess!
1434+
14301435
# Strings
14311436

14321437
Strings are an important concept for any programmer to master. Rust's string
@@ -1507,76 +1512,6 @@ low-level details matter, they really matter. Just remember that `String`s
15071512
allocate memory and control their data, while `&str`s are a reference to
15081513
another string, and you'll be all set.
15091514

1510-
# Vectors
1511-
1512-
Like many programming languages, Rust has a list type for when you want a list
1513-
of things. But similar to strings, Rust has different types to represent this
1514-
idea: `Vec<T>` (a 'vector'), `[T, .. N]` (an 'array'), and `&[T]` (a 'slice').
1515-
Whew!
1516-
1517-
Vectors are similar to `String`s: they have a dynamic length, and they
1518-
allocate enough memory to fit. You can create a vector with the `vec!` macro:
1519-
1520-
```{rust}
1521-
let nums = vec![1i, 2i, 3i];
1522-
```
1523-
1524-
Notice that unlike the `println!` macro we've used in the past, we use square
1525-
brackets (`[]`) with `vec!`. Rust allows you to use either in either situation,
1526-
this is just convention.
1527-
1528-
You can create an array with just square brackets:
1529-
1530-
```{rust}
1531-
let nums = [1i, 2i, 3i];
1532-
```
1533-
1534-
So what's the difference? An array has a fixed size, so you can't add or
1535-
subtract elements:
1536-
1537-
```{rust,ignore}
1538-
let mut nums = vec![1i, 2i, 3i];
1539-
nums.push(4i); // works
1540-
1541-
let mut nums = [1i, 2i, 3i];
1542-
nums.push(4i); // error: type `[int, .. 3]` does not implement any method
1543-
// in scope named `push`
1544-
```
1545-
1546-
The `push()` method lets you append a value to the end of the vector. But
1547-
since arrays have fixed sizes, adding an element doesn't make any sense.
1548-
You can see how it has the exact type in the error message: `[int, .. 3]`.
1549-
An array of `int`s, with length 3.
1550-
1551-
Similar to `&str`, a slice is a reference to another array. We can get a
1552-
slice from a vector by using the `as_slice()` method:
1553-
1554-
```{rust}
1555-
let vec = vec![1i, 2i, 3i];
1556-
let slice = vec.as_slice();
1557-
```
1558-
1559-
All three types implement an `iter()` method, which returns an iterator. We'll
1560-
talk more about the details of iterators later, but for now, the `iter()` method
1561-
allows you to write a `for` loop that prints out the contents of a vector, array,
1562-
or slice:
1563-
1564-
```{rust}
1565-
let vec = vec![1i, 2i, 3i];
1566-
1567-
for i in vec.iter() {
1568-
println!("{}", i);
1569-
}
1570-
```
1571-
1572-
This code will print each number in order, on its own line.
1573-
1574-
There's a whole lot more to vectors, but that's enough to get started. We have
1575-
now learned all of the most basic Rust concepts. We're ready to start building
1576-
our guessing game, but we need to know how to do one last thing first: get
1577-
input from the keyboard. You can't have a guessing game without the ability to
1578-
guess!
1579-
15801515
# Standard Input
15811516

15821517
Getting input from the keyboard is pretty easy, but uses some things

branches/try/src/doc/tutorial.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ If you've fulfilled those prerequisites, something along these lines
114114
should work.
115115

116116
~~~~console
117-
$ curl -O http://static.rust-lang.org/dist/rust-nightly.tar.gz
117+
$ curl -O https://static.rust-lang.org/dist/rust-nightly.tar.gz
118118
$ tar -xzf rust-nightly.tar.gz
119119
$ cd rust-nightly
120120
$ ./configure
@@ -131,8 +131,8 @@ When complete, `make install` will place several programs into
131131
`/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
132132
API-documentation tool.
133133

134-
[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz
135-
[win-exe]: http://static.rust-lang.org/dist/rust-nightly-install.exe
134+
[tarball]: https://static.rust-lang.org/dist/rust-nightly.tar.gz
135+
[win-exe]: https://static.rust-lang.org/dist/rust-nightly-install.exe
136136

137137
## Compiling your first program
138138

0 commit comments

Comments
 (0)