Rust High Performance
上QQ阅读APP看书,第一时间看更新

Build configuration

There is one section in the Cargo.toml file that enables these configurations: the profile section. In this section, you will find one subsection for each of the profiles. Each of them gets declared with the [profile.{profile}] format. So, for example, for the development profile, it would be [profile.dev]. The different profile configuration keywords are the following:

  • dev for the development profile, used in cargo build or cargo run
  • release for the release profile, used in cargo build --release or cargo run --release
  • test for the testing profile, used in cargo test
  • bench for the benchmarking profile, used in cargo bench
  • doc for the documentation profile, used in cargo doc

When configuring each profile, you will have many options, and we will check all of them out here.