Merge pull request #133 from 0xmohit/fix_typos

fix typos
This commit is contained in:
Carol (Nichols || Goulding) 2016-07-14 14:22:32 -04:00 committed by GitHub
commit 086d7b473a
9 changed files with 13 additions and 13 deletions

View File

@ -361,7 +361,7 @@ executable application, as opposed to a library. Executables are often called
*binaries* (as in `/usr/bin`, if youre on a Unix system). *binaries* (as in `/usr/bin`, if youre on a Unix system).
Cargo has generated two files and one directory for us: a `Cargo.toml` and a Cargo has generated two files and one directory for us: a `Cargo.toml` and a
*src* directory with a *main.rs* file inside. These should look familliar, *src* directory with a *main.rs* file inside. These should look familiar,
theyre exactly what we created by hand, above. theyre exactly what we created by hand, above.
This output is all you need to get started. First, open `Cargo.toml`. It should This output is all you need to get started. First, open `Cargo.toml`. It should

View File

@ -89,7 +89,7 @@ two possible values:
```rust ```rust
fn main() { fn main() {
let t = true; let t = true;
let f: bool = false; // with explict type annotation let f: bool = false; // with explicit type annotation
} }
``` ```
@ -110,7 +110,7 @@ fn main() {
Rusts `char` represents a [Unicode Scalar Value], which means that it can Rusts `char` represents a [Unicode Scalar Value], which means that it can
represent a lot more than just ASCII. Character isnt really a concept in represent a lot more than just ASCII. Character isnt really a concept in
Unicode, however: your human intutition for what a character is may not match Unicode, however: your human intuition for what a character is may not match
up with a `char`. It also means that `char`s are four bytes each. up with a `char`. It also means that `char`s are four bytes each.
[Unicode Scalar Value]: http://www.unicode.org/glossary/#unicode_scalar_value [Unicode Scalar Value]: http://www.unicode.org/glossary/#unicode_scalar_value

View File

@ -55,7 +55,7 @@ As you can see, the first index is `0`.
### Single-element tuples ### Single-element tuples
Theres one last trick with tuples: `(5)` is actually ambiguous: is it a tuple, Theres one last trick with tuples: `(5)` is actually ambiguous: is it a tuple,
or is it a `5` in parethesis? If you need to disambiguate, use a comma: or is it a `5` in parenthesis? If you need to disambiguate, use a comma:
```rust ```rust
fn main() { fn main() {

View File

@ -131,10 +131,10 @@ to the operating system: when it goes out of scope! When a variable goes out of
scope, a special function is called. This function is called `drop()`, and it scope, a special function is called. This function is called `drop()`, and it
is where the author of `String` can put the code to return the memory. is where the author of `String` can put the code to return the memory.
> Aside: This pattern is sometimes called “Resource Aquisition Is > Aside: This pattern is sometimes called “Resource Acquisition Is
> Initialization” in C++, or “RAII” for short. While they are very similar, > Initialization” in C++, or “RAII” for short. While they are very similar,
> Rusts take on this concept has a number of differences, and so we dont tend > Rusts take on this concept has a number of differences, and so we dont tend
> to use the same term. If youre familliar with this idea, keep in mind that it > to use the same term. If youre familiar with this idea, keep in mind that it
> is _roughly_ similar in Rust, but not identical. > is _roughly_ similar in Rust, but not identical.
This pattern has a profound impact on the way that Rust code is written. It may This pattern has a profound impact on the way that Rust code is written. It may
@ -404,7 +404,7 @@ fn takes_and_gives_back(a_string: String) -> String {
} }
``` ```
With simililar annotations: With similiar annotations:
```rust ```rust
fn main() { fn main() {

View File

@ -180,7 +180,7 @@ let mut s = String::from("hello");
let r2 = &mut s; let r2 = &mut s;
``` ```
There is a simlar rule for combining the two kinds of references. This code errors: There is a similar rule for combining the two kinds of references. This code errors:
```rust,ignore ```rust,ignore
let mut s = String::from("hello"); let mut s = String::from("hello");

View File

@ -110,7 +110,7 @@ Now were tracking both a start _and_ and ending index. Even more chances for
things to go wrong. We now have three unrelated variable bindings floating things to go wrong. We now have three unrelated variable bindings floating
around which need to be kept in sync. around which need to be kept in sync.
Luckily, Rust has a solution to this probem: string slices. Luckily, Rust has a solution to this problem: string slices.
# String slices # String slices

View File

@ -12,7 +12,7 @@ let s2 = s1.clone();
println!("{}", s1); println!("{}", s1);
``` ```
The call to `clone()` is attatched to `s1` with a dot. This is called method The call to `clone()` is attached to `s1` with a dot. This is called method
syntax, and its a way to call certain functions with a different style. syntax, and its a way to call certain functions with a different style.
Why have two ways to call functions? Well talk about some deeper reasons Why have two ways to call functions? Well talk about some deeper reasons
@ -127,7 +127,7 @@ fn distance(p1: Point, p2: Point) -> f64 {
# } # }
``` ```
Other than this, the rest of the example is familliar: an implementation of Other than this, the rest of the example is familiar: an implementation of
`distance()`, and using the method to find an answer. `distance()`, and using the method to find an answer.
There are two differences. The first is in the first argument. Instead of a name There are two differences. The first is in the first argument. Instead of a name

View File

@ -176,7 +176,7 @@ println!("x is: {}", x);
``` ```
We can't print out `x`! The error messages reference something we talked about We can't print out `x`! The error messages reference something we talked about
breifly before, the `Display` trait. In order to implement this function, we briefly before, the `Display` trait. In order to implement this function, we
need to talk about traits. But we only need to talk about traits to implement need to talk about traits. But we only need to talk about traits to implement
our own generic functions; we don't need this understanding to use them. So our own generic functions; we don't need this understanding to use them. So
rather than get into more details about this right now, let's talk about other rather than get into more details about this right now, let's talk about other

View File

@ -158,7 +158,7 @@ match some_u8_value {
The `_` pattern matches anything at all, and so with it as the final pattern, The `_` pattern matches anything at all, and so with it as the final pattern,
Rust can understand that we have all our bases covered. It's not only used for Rust can understand that we have all our bases covered. It's not only used for
this sort of exhastiveness issue, though. It's useful any time we don't want to this sort of exhaustiveness issue, though. It's useful any time we don't want to
deal with a number of cases. Consider this scenario: if we wanted to print out deal with a number of cases. Consider this scenario: if we wanted to print out
something one one, three, five, and seven: something one one, three, five, and seven: