Skip to content

Commit 5424f21

Browse files
committed
docs: Give all tutorials consistent titles and intro sections
1 parent ae1a730 commit 5424f21

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

doc/tutorial-ffi.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Interacting with foreign code
1+
% Rust Foreign Function Interface Tutorial
2+
3+
# Introduction
24

35
One of Rust's aims, as a system programming language, is to
46
interoperate well with C code.
@@ -38,7 +40,7 @@ fn main(args: ~[~str]) {
3840
}
3941
~~~~
4042

41-
## Foreign modules
43+
# Foreign modules
4244

4345
Before we can call `SHA1`, we have to declare it. That is what this
4446
part of the program is responsible for:
@@ -68,7 +70,7 @@ extern mod something {
6870
}
6971
~~~~
7072

71-
## Foreign calling conventions
73+
# Foreign calling conventions
7274

7375
Most foreign code will be C code, which usually uses the `cdecl` calling
7476
convention, so that is what Rust uses by default when calling foreign
@@ -88,7 +90,7 @@ The `"abi"` attribute applies to a foreign module (it can not be applied
8890
to a single function within a module), and must be either `"cdecl"`
8991
or `"stdcall"`. Other conventions may be defined in the future.
9092

91-
## Unsafe pointers
93+
# Unsafe pointers
9294

9395
The foreign `SHA1` function is declared to take three arguments, and
9496
return a pointer.
@@ -118,7 +120,7 @@ caution—unlike Rust's other pointer types, unsafe pointers are
118120
completely unmanaged, so they might point at invalid memory, or be
119121
null pointers.
120122

121-
## Unsafe blocks
123+
# Unsafe blocks
122124

123125
The `sha1` function is the most obscure part of the program.
124126

@@ -159,7 +161,7 @@ unsafe fn kaboom() { ~"I'm harmless!"; }
159161
This function can only be called from an unsafe block or another
160162
unsafe function.
161163

162-
## Pointer fiddling
164+
# Pointer fiddling
163165

164166
The standard library defines a number of helper functions for dealing
165167
with unsafe data, casting between types, and generally subverting
@@ -202,7 +204,7 @@ unsafe pointer that was returned by `SHA1`. SHA1 digests are always
202204
twenty bytes long, so we can pass `20u` for the length of the new
203205
vector.
204206

205-
## Passing structures
207+
# Passing structures
206208

207209
C functions often take pointers to structs as arguments. Since Rust
208210
structs are binary-compatible with C structs, Rust programs can call

doc/tutorial-macros.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Macros
1+
% Rust Macros Tutorial
2+
3+
# Introduction
24

35
Functions are the programmer's primary tool of abstraction, but there are
46
cases in which they are insufficient, because the programmer wants to
@@ -50,7 +52,7 @@ early_return!(input_2 special_b);
5052

5153
Macros are defined in pattern-matching style:
5254

53-
## Invocation syntax
55+
# Invocation syntax
5456

5557
On the left-hand-side of the `=>` is the macro invocation syntax. It is
5658
free-form, excepting the following rules:
@@ -69,7 +71,7 @@ rules of tokenization apply,
6971
So `($x:ident => (($e:expr)))`, though excessively fancy, would create a macro
7072
that could be invoked like `my_macro!(i=>(( 2+2 )))`.
7173

72-
## Transcription syntax
74+
# Transcription syntax
7375

7476
The right-hand side of the `=>` follows the same rules as the left-hand side,
7577
except that `$` need only be followed by the name of the syntactic fragment
@@ -80,9 +82,9 @@ an expression; currently, user-defined macros can only be invoked in
8082
expression position (even though `macro_rules!` itself can be in item
8183
position).
8284

83-
## Multiplicity
85+
# Multiplicity
8486

85-
### Invocation
87+
## Invocation
8688

8789
Going back to the motivating example, suppose that we wanted each invocation
8890
of `early_return` to potentially accept multiple "special" identifiers. The

doc/tutorial-tasks.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
% Tasks and communication in Rust
1+
% Rust Tasks and Communication Tutorial
2+
3+
# Introduction
24

35
Rust supports a system of lightweight tasks, similar to what is found
46
in Erlang or other actor systems. Rust tasks communicate via messages

0 commit comments

Comments
 (0)