# Struct cargo::core::profiles::Profiles

source ·

    pub struct Profiles {
        incremental: Option<bool>,
        dir_names: HashMap<InternedString, InternedString>,
        by_name: HashMap<InternedString, ProfileMaker>,
        original_profiles: BTreeMap<InternedString, TomlProfile>,
        requested_profile: InternedString,
        rustc_host: InternedString,
    }

Expand description

Collection of all profiles.

To get a specific `Profile`, you usually create this and call `get_profile` then.

## Fields§

§`incremental: Option<bool>`

Incremental compilation can be overridden globally via:

- `CARGO_INCREMENTAL` environment variable.
- `build.incremental` config value.

§`dir_names: HashMap<InternedString, InternedString>`

Map of profile name to directory name for that profile.

§`by_name: HashMap<InternedString, ProfileMaker>`

The profile makers. Key is the profile name.

§`original_profiles: BTreeMap<InternedString, TomlProfile>`

The original profiles written by the user in the manifest and config.

This is here to assist with error reporting, as the `ProfileMaker` values have the inherits chains all merged together.

§`requested_profile: InternedString`

The profile the user requested to use.

§`rustc_host: InternedString`

The host target for rustc being used by this `Profiles`.

## Implementations§

source§

### impl Profiles

source

#### pub fn new( ws: &Workspace<'_>, requested_profile: InternedString, ) -> CargoResult<Profiles>

source

#### fn predefined_dir_names() -> HashMap<InternedString, InternedString>

Returns the hard-coded directory names for built-in profiles.

source

#### fn add_root_profiles( profile_makers: &mut Profiles, profiles: &BTreeMap<InternedString, TomlProfile>, trim_paths_enabled: bool, )

Initialize `by_name` with the two “root” profiles, `dev`, and `release` given the user’s definition.

source

#### fn predefined_profiles() -> Vec<(&'static str, TomlProfile)>

Returns the built-in profiles (not including dev/release, which are “root” profiles).

source

#### fn add_maker( &mut self, name: InternedString, profile: &TomlProfile, profiles: &BTreeMap<InternedString, TomlProfile>, ) -> CargoResult<()>

Creates a `ProfileMaker`, and inserts it into `self.by_name`.

source

#### fn process_chain( &mut self, name: InternedString, profile: &TomlProfile, set: &mut HashSet<InternedString>, profiles: &BTreeMap<InternedString, TomlProfile>, ) -> CargoResult<ProfileMaker>

Build a `ProfileMaker` by recursively following the `inherits` setting.

- `name`: The name of the profile being processed.
- `profile`: The TOML profile being processed.
- `set`: Set of profiles that have been visited, used to detect cycles.
- `profiles`: Map of all TOML profiles.

Returns a `ProfileMaker` to be used for the given named profile.

source

#### pub fn get_profile( &self, pkg_id: PackageId, is_member: bool, is_local: bool, unit_for: UnitFor, kind: CompileKind, ) -> Profile

Retrieves the profile for a target. `is_member` is whether or not this package is a member of the workspace.

source

#### pub fn get_profile_run_custom_build( &self, for_unit_profile: &Profile, ) -> Profile

The profile for running a `build.rs` script is only used for setting a few environment variables. To ensure proper de-duplication of the running `Unit`, this uses a stripped-down profile (so that unrelated profile flags don’t cause `build.rs` to needlessly run multiple times).

source

#### pub fn base_profile(&self) -> Profile

This returns the base profile. This is currently used for the `[Finished]` line. It is not entirely accurate, since it doesn’t select for the package that was actually built.

source

#### pub fn get_dir_name(&self) -> InternedString

Gets the directory name for a profile, like `debug` or `release`.

source

#### pub fn validate_packages( &self, profiles: Option<&TomlProfiles>, shell: &mut Shell, resolve: &Resolve, ) -> CargoResult<()>

Used to check for overrides for non-existing packages.

source

#### fn get_profile_maker(&self, name: &str) -> CargoResult<&ProfileMaker>

Returns the profile maker for the given profile name.

## Trait Implementations§

source§

### impl Clone for Profiles

source§

#### fn clone(&self) -> Profiles

Returns a copy of the value. Read more
1.0.0 · source§

#### fn clone_from(&mut self, source: &Self)

Performs copy-assignment from `source`. Read more
source§

### impl Debug for Profiles

source§

#### fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

## Auto Trait Implementations§

§

### impl Freeze for Profiles

§

### impl RefUnwindSafe for Profiles

§

### impl Send for Profiles

§

### impl Sync for Profiles

§

### impl Unpin for Profiles

§

### impl UnwindSafe for Profiles

## Blanket Implementations§

source§

### impl<T> Any for T
where T: 'static + ?Sized,

source§

#### fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more
source§

### impl<T> Borrow<T> for T
where T: ?Sized,

source§

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

### impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

### impl<T> CloneToUninit for T
where T: Clone,

source§

#### default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (`clone_to_uninit`)
Performs copy-assignment from `self` to `dst`. Read more
source§

### impl<T> From<T> for T

source§

#### fn from(t: T) -> T

Returns the argument unchanged.

§

### impl<T> Instrument for T

§

#### fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [`Span`], returning an `Instrumented` wrapper. Read more
§

#### fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more
source§

### impl<T, U> Into<U> for T
where U: From<T>,

source§

#### fn into(self) -> U

Calls `U::from(self)`.

That is, this conversion is whatever the implementation of `From<T> for U` chooses to do.

source§

### impl<T> IntoEither for T

source§

#### fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts `self` into a `Left` variant of `Either<Self, Self>` if `into_left` is `true`. Converts `self` into a `Right` variant of `Either<Self, Self>` otherwise. Read more
source§

#### fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts `self` into a `Left` variant of `Either<Self, Self>` if `into_left(&self)` returns `true`. Converts `self` into a `Right` variant of `Either<Self, Self>` otherwise. Read more
§

### impl<T> Pointable for T

§

#### const ALIGN: usize = _

The alignment of pointer.
§

#### type Init = T

The type for initializers.
§

#### unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

#### unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

#### unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

#### unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

### impl<T> Same for T

§

#### type Output = T

Should always be `Self`
source§

### impl<T> ToOwned for T
where T: Clone,

§

#### type Owned = T

The resulting type after obtaining ownership.
source§

#### fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

#### fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

### impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

#### type Error = Infallible

The type returned in the event of a conversion error.
source§

#### fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

### impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

#### fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

### impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

#### fn vzip(self) -> V

§

### impl<T> WithSubscriber for T

§

#### fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more
§

#### fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more

## Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain `repr(...)` attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 160 bytes