You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replacing all references to the 2nd person with references to the 3rd
person (excluding `authors = [ "Your name <[email protected]>" ]` and
`file:///home/yourname/projects/hello_world` in `hello-cargo.md`)
Cargo expects your source files to live inside a `src` directory. That leaves
45
-
the top level for other things, like READMEs, license information, and anything
46
-
not related to your code. Cargo helps us keep our projects nice and tidy. A
47
-
place for everything, and everything in its place.
44
+
Cargo expects our source files to live inside a `src` directory. That leaves the
45
+
top level for other things, like READMEs, license information, and anything not
46
+
related to our code. Cargo helps us keep our projects nice and tidy. A place for
47
+
everything, and everything in its place.
48
48
49
49
Next, our configuration file:
50
50
51
51
```bash
52
52
$ editor Cargo.toml
53
53
```
54
54
55
-
Make sure to get this name right: you need the capital `C`!
55
+
Make sure to get this name right: we need the capital `C`!
56
56
57
57
Put this inside:
58
58
@@ -109,25 +109,25 @@ about the future: when our project gets more complex, we need to do more
109
109
things to get all of the parts to properly compile. With Cargo, as our project
110
110
grows, we can just run `cargo build`, and it’ll work the right way.
111
111
112
-
When your project is finally ready for release, you can use
113
-
`cargo build --release` to compile your project with optimizations.
112
+
When our project is finally ready for release, we can use `cargo build
113
+
--release` to compile our project with optimizations.
114
114
115
-
You'll also notice that Cargo has created a new file: `Cargo.lock`.
115
+
We'll also notice that Cargo has created a new file: `Cargo.lock`.
116
116
117
117
```toml
118
118
[root]
119
119
name = "hello_world"
120
120
version = "0.0.1"
121
121
```
122
122
123
-
The `Cargo.lock` file is used by Cargo to keep track of dependencies in your application.
124
-
Right now, we don’t have any, so it’s a bit sparse. You won't ever need
125
-
to touch this file yourself, just let Cargo handle it.
123
+
The `Cargo.lock` file is used by Cargo to keep track of dependencies in our
124
+
application. Right now, we don’t have any, so it’s a bit sparse. We won't ever
125
+
need to touch this file ourselves, just let Cargo handle it.
126
126
127
127
That’s it! We’ve successfully built `hello_world` with Cargo. Even though our
128
-
program is simple, it’s using much of the real tooling that you’ll use for the
129
-
rest of your Rust career. You can expect to do this to get started with
130
-
virtually all Rust projects:
128
+
program is simple, it’s using much of the real tooling that we’ll use for the
129
+
rest of our Rust career. We can expect to do this to get started with virtually
130
+
all Rust projects:
131
131
132
132
```bash
133
133
$ git clone someurl.com/foo
@@ -137,17 +137,19 @@ $ cargo build
137
137
138
138
## A New Project
139
139
140
-
You don’t have to go through this whole process every time you want to start a
141
-
new project! Cargo has the ability to make a bare-bones project directory in
142
-
which you can start developing right away.
140
+
We don’t have to go through this whole process every time we want to start a new
141
+
project! Cargo has the ability to make a bare-bones project directory in which
142
+
we can start developing right away.
143
143
144
144
To start a new project with Cargo, use `cargo new`:
145
145
146
146
```bash
147
147
$ cargo new hello_world --bin
148
148
```
149
149
150
-
We’re passing `--bin` because our goal is to get straight to making an executable application, as opposed to a library. Executables are often called ‘binaries.’ (as in `/usr/bin`, if you’re on a Unix system)
150
+
We’re passing `--bin` because our goal is to get straight to making an
151
+
executable application, as opposed to a library. Executables are often called
152
+
‘binaries.’ (as in `/usr/bin`, if we’re on a Unix system)
151
153
152
154
Let's check out what Cargo has generated for us:
153
155
@@ -162,7 +164,7 @@ $ tree .
162
164
1 directory, 2 files
163
165
```
164
166
165
-
If you don't have the `tree` command, you can probably get it from your
167
+
If we don't have the `tree` command, we can probably get it from our
166
168
distribution’s package manager. It’s not necessary, but it’s certainly useful.
167
169
168
170
This is all we need to get started. First, let’s check out `Cargo.toml`:
0 commit comments