Introduce the cargo run command earlier (squashed)

This commit is contained in:
Matej Lach 2014-08-13 11:09:02 +01:00
parent 9d554212de
commit bede9ecdfe

View File

@ -1796,6 +1796,21 @@ Excellent! Open up your `src/main.rs` again. We'll be writing all of
our code in this file. We'll talk about multiple-file projects later on in the
guide.
Before we move on, let me show you one more Cargo command: `run`. `cargo run`
is kind of like `cargo build`, but it also then runs the produced exectuable.
Try it out:
```{notrust,ignore}
$ cargo run
Compiling guessing_game v0.1.0 (file:/home/you/projects/guessing_game)
Running `target/guessing_game`
Hello, world!
$
```
Great! The `run` command comes in handy when you need to rapidly iterate on a project.
Our game is just such a project, we need to quickly test each iteration before moving on to the next one.
## Processing a Guess
Let's get to it! The first thing we need to do for our guessing game is
@ -2731,16 +2746,6 @@ mod hello {
This will work:
```{notrust,ignore}
$ cargo build
Compiling modules v0.1.0 (file:/home/you/projects/modules)
$
```
Before we move on, let me show you one more Cargo command: `run`. `cargo run`
is kind of like `cargo build`, but it also then runs the produced exectuable.
Try it out:
```{notrust,ignore}
$ cargo run
Compiling modules v0.1.0 (file:/home/steve/tmp/modules)
@ -4700,4 +4705,3 @@ fail.
# Macros
# Unsafe