In the previous chapter, we saw the following directory heirarcy:
foo ├── Cargo.toml └── src └── main.rs
Suppose that we wanted to have two binaries in the same project, though. What then?
It turns out that
cargo supports this. The default binary name is
we saw before, but you can add additional binaries by placing them in a
foo ├── Cargo.toml └── src ├── main.rs └── bin └── my_other_bin.rs
cargo to compile or run this binary as opposed to the default or other
binaries, we just pass
--bin my_other_bin flag, where
is the name of the binary we want to work with.
In addition to extra binaries, there is support for benchmarks, tests, and examples. The full capabilities are documented here.
In the next chapter, we will look more closely at tests.