@@ -63,6 +63,13 @@ these platforms are required to have each of the following:
63
63
| Target | std | rustc| cargo| notes |
64
64
| -------------------------------| -----| -----| -----| ----------------------------|
65
65
| ` i686-pc-windows-msvc ` | ✓ | ✓ | ✓ | 32-bit MSVC (Windows 7+) |
66
+ | ` x86_64-unknown-linux-musl ` | ✓ | | | 64-bit Linux with MUSL |
67
+ | ` arm-linux-androideabi ` | ✓ | | | ARM Android |
68
+ | ` arm-unknown-linux-gnueabi ` | ✓ | ✓ | | ARM Linux (2.6.18+) |
69
+ | ` arm-unknown-linux-gnueabihf ` | ✓ | ✓ | | ARM Linux (2.6.18+) |
70
+ | ` aarch64-unknown-linux-gnu ` | ✓ | | | ARM64 Linux (2.6.18+) |
71
+ | ` mips-unknown-linux-gnu ` | ✓ | | | MIPS Linux (2.6.18+) |
72
+ | ` mipsel-unknown-linux-gnu ` | ✓ | | | MIPS (LE) Linux (2.6.18+) |
66
73
67
74
### Tier 3
68
75
@@ -75,15 +82,8 @@ unofficial locations.
75
82
76
83
| Target | std | rustc| cargo| notes |
77
84
| -------------------------------| -----| -----| -----| ----------------------------|
78
- | ` x86_64-unknown-linux-musl ` | ✓ | | | 64-bit Linux with MUSL |
79
- | ` arm-linux-androideabi ` | ✓ | | | ARM Android |
80
85
| ` i686-linux-android ` | ✓ | | | 32-bit x86 Android |
81
86
| ` aarch64-linux-android ` | ✓ | | | ARM64 Android |
82
- | ` arm-unknown-linux-gnueabi ` | ✓ | ✓ | | ARM Linux (2.6.18+) |
83
- | ` arm-unknown-linux-gnueabihf ` | ✓ | ✓ | | ARM Linux (2.6.18+) |
84
- | ` aarch64-unknown-linux-gnu ` | ✓ | | | ARM64 Linux (2.6.18+) |
85
- | ` mips-unknown-linux-gnu ` | ✓ | | | MIPS Linux (2.6.18+) |
86
- | ` mipsel-unknown-linux-gnu ` | ✓ | | | MIPS (LE) Linux (2.6.18+) |
87
87
| ` powerpc-unknown-linux-gnu ` | ✓ | | | PowerPC Linux (2.6.18+) |
88
88
| ` i386-apple-ios ` | ✓ | | | 32-bit x86 iOS |
89
89
| ` x86_64-apple-ios ` | ✓ | | | 64-bit x86 iOS |
@@ -127,7 +127,7 @@ not want the script to run ‘sudo’ then pass it the --disable-sudo flag.
127
127
You may uninstall later by running /usr/local/lib/rustlib/uninstall.sh,
128
128
or by running this script again with the --uninstall flag.
129
129
130
- Continue? (y/N)
130
+ Continue? (y/N)
131
131
```
132
132
133
133
From here, press ` y ` for ‘yes’, and then follow the rest of the prompts.
@@ -188,7 +188,7 @@ was installed.
188
188
Now that you have Rust installed, we'll help you write your first Rust program.
189
189
It's traditional when learning a new language to write a little program to
190
190
print the text “Hello, world!” to the screen, and in this section, we'll follow
191
- that tradition.
191
+ that tradition.
192
192
193
193
The nice thing about starting with such a simple program is that you can
194
194
quickly verify that your compiler is installed, and that it's working properly.
@@ -202,7 +202,7 @@ practicing it early on is good.
202
202
> There are a number of extensions in development by the community, and the
203
203
> Rust team ships plugins for [ various editors] . Configuring your editor or
204
204
> IDE is out of the scope of this tutorial, so check the documentation for your
205
- > specific setup.
205
+ > specific setup.
206
206
207
207
[ SolidOak ] : https://github.com/oakes/SolidOak
208
208
[ various editors ] : https://github.com/rust-lang/rust/blob/master/src/etc/CONFIGS.md
@@ -244,14 +244,14 @@ following commands:
244
244
245
245
``` bash
246
246
$ rustc main.rs
247
- $ ./main
247
+ $ ./main
248
248
Hello, world!
249
249
```
250
250
251
251
In Windows, just replace ` main ` with ` main.exe ` . Regardless of your operating
252
252
system, you should see the string ` Hello, world! ` print to the terminal. If you
253
253
did, then congratulations! You've officially written a Rust program. That makes
254
- you a Rust programmer! Welcome.
254
+ you a Rust programmer! Welcome.
255
255
256
256
## Anatomy of a Rust Program
257
257
@@ -285,13 +285,13 @@ Inside the `main()` function:
285
285
This line does all of the work in this little program: it prints text to the
286
286
screen. There are a number of details that are important here. The first is
287
287
that it’s indented with four spaces, not tabs.
288
-
288
+
289
289
The second important part is the ` println!() ` line. This is calling a Rust
290
290
* [ macro] * , which is how metaprogramming is done in Rust. If it were calling a
291
291
function instead, it would look like this: ` println() ` (without the !). We'll
292
292
discuss Rust macros in more detail later, but for now you just need to
293
293
know that when you see a ` ! ` that means that you’re calling a macro instead of
294
- a normal function.
294
+ a normal function.
295
295
296
296
297
297
[ macro ] : macros.html
@@ -313,7 +313,7 @@ begin. Most lines of Rust code end with a `;`.
313
313
## Compiling and Running Are Separate Steps
314
314
315
315
In "Writing and Running a Rust Program", we showed you how to run a newly
316
- created program. We'll break that process down and examine each step now.
316
+ created program. We'll break that process down and examine each step now.
317
317
318
318
Before running a Rust program, you have to compile it. You can use the Rust
319
319
compiler by entering the ` rustc ` command and passing it the name of your source
@@ -395,7 +395,7 @@ in which you installed Rust, to determine if Cargo is separate.
395
395
## Converting to Cargo
396
396
397
397
Let’s convert the Hello World program to Cargo. To Cargo-fy a project, you need
398
- to do three things:
398
+ to do three things:
399
399
400
400
1 . Put your source file in the right directory.
401
401
2 . Get rid of the old executable (` main.exe ` on Windows, ` main ` everywhere else)
@@ -419,7 +419,7 @@ Cargo expects your source files to live inside a *src* directory, so do that
419
419
first. This leaves the top-level project directory (in this case,
420
420
* hello_world* ) for READMEs, license information, and anything else not related
421
421
to your code. In this way, using Cargo helps you keep your projects nice and
422
- tidy. There's a place for everything, and everything is in its place.
422
+ tidy. There's a place for everything, and everything is in its place.
423
423
424
424
Now, copy * main.rs* to the * src* directory, and delete the compiled file you
425
425
created with ` rustc ` . As usual, replace ` main ` with ` main.exe ` if you're on
@@ -428,15 +428,15 @@ Windows.
428
428
This example retains ` main.rs ` as the source filename because it's creating an
429
429
executable. If you wanted to make a library instead, you'd name the file
430
430
` lib.rs ` . This convention is used by Cargo to successfully compile your
431
- projects, but it can be overridden if you wish.
431
+ projects, but it can be overridden if you wish.
432
432
433
433
### Creating a Configuration File
434
434
435
435
Next, create a new file inside your * hello_world* directory, and call it
436
436
` Cargo.toml ` .
437
437
438
438
Make sure to capitalize the ` C ` in ` Cargo.toml ` , or Cargo won't know what to do
439
- with the configuration file.
439
+ with the configuration file.
440
440
441
441
This file is in the * [ TOML] * (Tom's Obvious, Minimal Language) format. TOML is
442
442
similar to INI, but has some extra goodies, and is used as Cargo’s
@@ -464,7 +464,7 @@ know to compile your program: its name, what version it is, and who wrote it.
464
464
Once you've added this information to the * Cargo.toml* file, save it to finish
465
465
creating the configuration file.
466
466
467
- ## Building and Running a Cargo Project
467
+ ## Building and Running a Cargo Project
468
468
469
469
With your * Cargo.toml* file in place in your project's root directory, you
470
470
should be ready to build and run your Hello World program! To do so, enter the
@@ -477,7 +477,7 @@ $ ./target/debug/hello_world
477
477
Hello, world!
478
478
```
479
479
480
- Bam! If all goes well, ` Hello, world! ` should print to the terminal once more.
480
+ Bam! If all goes well, ` Hello, world! ` should print to the terminal once more.
481
481
482
482
You just built a project with ` cargo build ` and ran it with
483
483
` ./target/debug/hello_world ` , but you can actually do both in one step with
@@ -532,7 +532,7 @@ doesn't have dependencies, so the file is a bit sparse. Realistically, you
532
532
won't ever need to touch this file yourself; just let Cargo handle it.
533
533
534
534
That’s it! If you've been following along, you should have successfully built
535
- ` hello_world ` with Cargo.
535
+ ` hello_world ` with Cargo.
536
536
537
537
Even though the project is simple, it now uses much of the real tooling you’ll
538
538
use for the rest of your Rust career. In fact, you can expect to start
@@ -587,7 +587,7 @@ fn main() {
587
587
}
588
588
```
589
589
590
- Cargo has generated a "Hello World!" for you, and you’re ready to start coding!
590
+ Cargo has generated a "Hello World!" for you, and you’re ready to start coding!
591
591
592
592
> Note: If you want to look at Cargo in more detail, check out the official [ Cargo
593
593
guide] , which covers all of its features.
@@ -598,7 +598,7 @@ guide], which covers all of its features.
598
598
599
599
This chapter covered the basics that will serve you well through the rest of
600
600
this book, and the rest of your time with Rust. Now that you’ve got the tools
601
- down, we'll cover more about the Rust language itself.
601
+ down, we'll cover more about the Rust language itself.
602
602
603
603
You have two options: Dive into a project with ‘[ Learn Rust] [ learnrust ] ’, or
604
604
start from the bottom and work your way up with ‘[ Syntax and
0 commit comments