Fix some typos in tutorial
This commit is contained in:
parent
4a2d277bbf
commit
eabc9f2295
|
@ -1,6 +1,6 @@
|
|||
# Interacting with foreign code
|
||||
|
||||
On of Rust's aims, as a system programming language, is to
|
||||
One of Rust's aims, as a system programming language, is to
|
||||
interoperate well with C code.
|
||||
|
||||
We'll start with an example. It's a bit bigger than usual, and
|
||||
|
|
|
@ -61,6 +61,8 @@ stored in data structures or returned.
|
|||
A block with no arguments is written `{|| body(); }`—you can not leave
|
||||
off the pipes.
|
||||
|
||||
FIXME mention bind
|
||||
|
||||
## Iteration
|
||||
|
||||
Functions taking blocks provide a good way to define non-trivial
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Modules and crates
|
||||
|
||||
The Rust namespace is divided in modules. Each source file starts with
|
||||
its own, empty module.
|
||||
The Rust namespace is divided into modules. Each source file starts
|
||||
with its own, empty module.
|
||||
|
||||
## Local modules
|
||||
|
||||
|
@ -153,7 +153,7 @@ restricted with `export` directives at the top of the module or file.
|
|||
|
||||
This defines a rock-solid encryption algorithm. Code outside of the
|
||||
module can refer to the `enc::encrypt` and `enc::decrypt` identifiers
|
||||
just fine, but it does not have access to `enc::syper_secret_number`.
|
||||
just fine, but it does not have access to `enc::super_secret_number`.
|
||||
|
||||
## Namespaces
|
||||
|
||||
|
@ -185,10 +185,10 @@ context.
|
|||
Identifiers can shadow each others. In this program, `x` is of type
|
||||
`int`:
|
||||
|
||||
type x = str;
|
||||
type t = str;
|
||||
fn main() {
|
||||
type x = int;
|
||||
let x: int;
|
||||
type t = int;
|
||||
let x: t;
|
||||
}
|
||||
|
||||
An `import` directive will only import into the namespaces for which
|
||||
|
|
|
@ -35,7 +35,7 @@ like `if` and `while` are available:
|
|||
|
||||
## Expression syntax
|
||||
|
||||
Though it isn't apparent in most everyday code, there is a fundamental
|
||||
Though it isn't apparent in all code, there is a fundamental
|
||||
difference between Rust's syntax and the predecessors in this family
|
||||
of languages. A lot of thing that are statements in C are expressions
|
||||
in Rust. This allows for useless things like this (which passes
|
||||
|
|
Loading…
Reference in New Issue