@@ -33,7 +33,8 @@ $ mv main.rs src/main.rs
33
33
```
34
34
35
35
Note that since we're creating an executable, we used ` main.rs ` . If we
36
- want to make a library instead, we should use ` lib.rs ` .
36
+ want to make a library instead, we should use ` lib.rs ` . This convention is required
37
+ for Cargo to successfully compile our projects, but it can be overridden if we wish.
37
38
Custom file locations for the entry point can be specified
38
39
with a [ ` [[lib]] ` or ` [[bin]] ` ] [ crates-custom ] key in the TOML file described below.
39
40
@@ -62,18 +63,17 @@ version = "0.0.1"
62
63
authors = [
" Your name <[email protected] >" ]
63
64
```
64
65
65
- This file is in the [ TOML] [ toml ] format. Let’s let it explain itself to you:
66
+ This file is in the [ TOML] [ toml ] format. TOML is similar to INI, but has some
67
+ extra goodies. According to the TOML docs,
66
68
67
69
> TOML aims to be a minimal configuration file format that's easy to read due
68
70
> to obvious semantics. TOML is designed to map unambiguously to a hash table.
69
71
> TOML should be easy to parse into data structures in a wide variety of
70
72
> languages.
71
73
72
- TOML is very similar to INI, but with some extra goodies.
73
-
74
74
[ toml ] : https://github.com/toml-lang/toml
75
75
76
- Once you have this file in place, we should be ready to build! Try this :
76
+ Once you have this file in place, we should be ready to build! To do so, run :
77
77
78
78
``` bash
79
79
$ cargo build
@@ -82,7 +82,7 @@ $ ./target/debug/hello_world
82
82
Hello, world!
83
83
```
84
84
85
- Bam! We build our project with ` cargo build ` , and run it with
85
+ Bam! We built our project with ` cargo build ` , and ran it with
86
86
` ./target/debug/hello_world ` . We can do both in one step with ` cargo run ` :
87
87
88
88
``` bash
@@ -103,9 +103,9 @@ Hello, world!
103
103
```
104
104
105
105
This hasn’t bought us a whole lot over our simple use of ` rustc ` , but think
106
- about the future: when our project gets more complex, we would need to do more
106
+ about the future: when our project gets more complex, we need to do more
107
107
things to get all of the parts to properly compile. With Cargo, as our project
108
- grows, we can just ` cargo build ` , and it’ll work the right way.
108
+ grows, we can just run ` cargo build ` , and it’ll work the right way.
109
109
110
110
When your project is finally ready for release, you can use
111
111
` cargo build --release ` to compile your project with optimizations.
@@ -118,7 +118,7 @@ name = "hello_world"
118
118
version = " 0.0.1"
119
119
```
120
120
121
- This file is used by Cargo to keep track of dependencies in your application.
121
+ The ` Cargo.lock ` file is used by Cargo to keep track of dependencies in your application.
122
122
Right now, we don’t have any, so it’s a bit sparse. You won't ever need
123
123
to touch this file yourself, just let Cargo handle it.
124
124
0 commit comments