Expand description
Handles built-in and customizable compiler flag presets.
Profiles
is a collections of built-in profiles, and profiles defined
in the root manifest and configurations.
To start using a profile, most of the time you start from Profiles::new
,
which does the followings:
- Create a
Profiles
by merging profiles from configs onto the profile from root manifest (seemerge_config_profiles
). - Add built-in profiles onto it (see
Profiles::add_root_profiles
). - Process profile inheritance for each profiles. (see
Profiles::add_maker
).
Then you can query a Profile
via Profiles::get_profile
, which respects
the profile overridden hierarchy described in below. The Profile
you get
is basically an immutable struct containing the compiler flag presets.
§Profile overridden hierarchy
Profile settings can be overridden for specific packages and build-time crates.
The precedence is explained in ProfileMaker
.
The algorithm happens within ProfileMaker::get_profile
.
Structs§
- Profile
- Profile settings used to determine which compiler flags to use for a target.
- Profile
Maker 🔒 - An object used for handling the profile hierarchy.
- Profiles
- Collection of all profiles.
- UnitFor
- Flags used in creating
Unit
s to indicate the purpose for the target, and to ensure the target’s dependencies have the correct settings.
Enums§
- Debug
Info - The debuginfo level setting.
- Lto
- The link-time-optimization setting.
- Panic
Setting 🔒 - How Cargo processes the
panic
setting or profiles. - Panic
Strategy - The
panic
setting. - Profile
Root - The root profile (dev/release).
- Strip
- The setting for choosing which symbols to strip.
- Strip
Inner
Functions§
- get_
config_ 🔒profile - Helper for fetching a profile from config.
- is_off 🔒
- Returns
true
if a string is a toggle that turns an option off. - merge_
config_ 🔒profiles - Takes the manifest profiles, and overlays the config profiles on-top.
- merge_
profile 🔒 - Merge the given TOML profile into the given
Profile
. - merge_
toml_ 🔒overrides - Merge package and build overrides from the given TOML profile into the given
Profile
. - validate_
packages_ 🔒unique - Validate that a package does not match multiple package override specs.
- validate_
packages_ 🔒unmatched - Check for any profile override specs that do not match any known packages.