File tree Expand file tree Collapse file tree 4 files changed +10
-8
lines changed Expand file tree Collapse file tree 4 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 1
1
# Interacting with foreign code
2
2
3
- On of Rust's aims, as a system programming language, is to
3
+ One of Rust's aims, as a system programming language, is to
4
4
interoperate well with C code.
5
5
6
6
We'll start with an example. It's a bit bigger than usual, and
Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ stored in data structures or returned.
61
61
A block with no arguments is written ` {|| body(); } ` —you can not leave
62
62
off the pipes.
63
63
64
+ FIXME mention bind
65
+
64
66
## Iteration
65
67
66
68
Functions taking blocks provide a good way to define non-trivial
Original file line number Diff line number Diff line change 1
1
# Modules and crates
2
2
3
- The Rust namespace is divided in modules. Each source file starts with
4
- its own, empty module.
3
+ The Rust namespace is divided into modules. Each source file starts
4
+ with its own, empty module.
5
5
6
6
## Local modules
7
7
@@ -153,7 +153,7 @@ restricted with `export` directives at the top of the module or file.
153
153
154
154
This defines a rock-solid encryption algorithm. Code outside of the
155
155
module can refer to the ` enc::encrypt ` and ` enc::decrypt ` identifiers
156
- just fine, but it does not have access to ` enc::syper_secret_number ` .
156
+ just fine, but it does not have access to ` enc::super_secret_number ` .
157
157
158
158
## Namespaces
159
159
@@ -185,10 +185,10 @@ context.
185
185
Identifiers can shadow each others. In this program, ` x ` is of type
186
186
` int ` :
187
187
188
- type x = str;
188
+ type t = str;
189
189
fn main() {
190
- type x = int;
191
- let x: int ;
190
+ type t = int;
191
+ let x: t ;
192
192
}
193
193
194
194
An ` import ` directive will only import into the namespaces for which
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ like `if` and `while` are available:
35
35
36
36
## Expression syntax
37
37
38
- Though it isn't apparent in most everyday code, there is a fundamental
38
+ Though it isn't apparent in all code, there is a fundamental
39
39
difference between Rust's syntax and the predecessors in this family
40
40
of languages. A lot of thing that are statements in C are expressions
41
41
in Rust. This allows for useless things like this (which passes
You can’t perform that action at this time.
0 commit comments