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 <you@example.com>" ]` 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`:
@@ -176,8 +178,8 @@ authors = ["Your Name <you@example.com>"]
176
178
```
177
179
178
180
Cargo has populated this file with reasonable defaults based off the arguments
179
-
you gave it and your`git` global configuration. You may notice that Cargo has
180
-
also initialized the `hello_world` directory as a `git` repository.
181
+
we gave it and our`git` global configuration. We may notice that Cargo has also
182
+
initialized the `hello_world` directory as a `git` repository.
181
183
182
184
Here’s what’s in `src/main.rs`:
183
185
@@ -187,20 +189,21 @@ fn main() {
187
189
}
188
190
```
189
191
190
-
Cargo has generated a "Hello World!" for us, and you’re ready to start coding! Cargo
191
-
has its own [guide][guide] which covers Cargo’s features in much more depth.
192
+
Cargo has generated a "Hello World!" for us, and we’re ready to start coding!
193
+
Cargo has its own [guide][guide] which covers Cargo’s features in much more
194
+
depth.
192
195
193
196
[guide]: http://doc.crates.io/guide.html
194
197
195
-
Now that you’ve got the tools down, let’s actually learn more about the Rust
196
-
language itself. These are the basics that will serve you well through the rest
197
-
of your time with Rust.
198
+
Now that we’ve got the tools down, let’s actually learn more about the Rust
199
+
language itself. These are the basics that will serve us well through the rest
200
+
of our time with Rust.
198
201
199
-
You have two options: Dive into a project with ‘[Learn Rust][learnrust]’, or
200
-
start from the bottom and work your way up with ‘[Syntax and
201
-
Semantics][syntax]’. More experienced systems programmers will probably prefer
202
-
‘Learn Rust’, while those from dynamic backgrounds may enjoy either. Different
203
-
people learn differently! Choose whatever’s right for you.
202
+
We have two options: Dive into a project with ‘[Learn Rust][learnrust]’, or
203
+
start from the bottom and work our way up with ‘[Syntax and Semantics][syntax]’.
204
+
More experienced systems programmers will probably prefer ‘Learn Rust’, while
205
+
those from dynamic backgrounds may enjoy either. Different people learn
0 commit comments