control system (git, hg, pijul, or fossil) or do not
initialize any version control at all (none), overriding
a global configuration.
- --bin Use a binary (application) template
- --lib Use a library template [default]
+ --bin Use a binary (application) template [default]
+ --lib Use a library template
--name NAME Set the resulting package name
-v, --verbose ... Use verbose output (-vv very verbose/build.rs output)
-q, --quiet No output printed to stdout
control system (git, hg, pijul, or fossil) or do not
initialize any version control at all (none), overriding
a global configuration.
- --bin Use a binary (application) template
- --lib Use a library template [default]
+ --bin Use a binary (application) template [default]
+ --lib Use a library template
--name NAME Set the resulting package name, defaults to the value of <path>
-v, --verbose ... Use verbose output (-vv very verbose/build.rs output)
-q, --quiet No output printed to stdout
(true, true) => bail!("can't specify both lib and binary outputs"),
(true, false) => NewProjectKind::Bin,
(false, true) => NewProjectKind::Lib,
- // default to lib
- (false, false) => NewProjectKind::Lib,
+ // default to bin
+ (false, false) => NewProjectKind::Bin,
};
let opts = NewOptions { version_control, kind, path, name };
```
We’re passing `--bin` because we’re making a binary program: if we
-were making a library, we’d leave it off.
+were making a library, we’d pass `--lib`.
Let’s check out what Cargo has generated for us:
```
We’re passing `--bin` because we’re making a binary program: if we
-were making a library, we’d leave it off. This also initializes a new `git`
+were making a library, we’d pass `--lib`. This also initializes a new `git`
repository by default. If you don't want it to do that, pass `--vcs none`.
Let’s check out what Cargo has generated for us:
1 directory, 2 files
```
-If we had just used `cargo new hello_world` without the `--bin` flag, then
-we would have a `lib.rs` instead of a `main.rs`. For now, however, this is all
-we need to get started. First, let’s check out `Cargo.toml`:
+Let’s take a closer look at `Cargo.toml`:
```toml
[package]