Struct cargo::util::config::key::ConfigKey

source ·
pub struct ConfigKey {
    env: String,
    parts: Vec<(String, usize)>,
}
Expand description

Key for a configuration variable.

This type represents a configuration variable that we’re looking up in Cargo’s configuration. This structure simultaneously keeps track of a corresponding environment variable name as well as a TOML config name. The intention here is that this is built up and torn down over time efficiently, avoiding clones and such as possible.

Fields§

§env: String§parts: Vec<(String, usize)>

Implementations§

Creates a new blank configuration key which is ready to get built up by using push and push_sensitive.

Creates a ConfigKey from the key specified.

The key specified is expected to be a period-separated toml configuration key.

Pushes a new sub-key on this ConfigKey. This sub-key should be equivalent to accessing a sub-table in TOML.

Note that this considers name to be case-insensitive, meaning that the corrseponding toml key is appended with this name as-is and the corresponding env key is appended with name after transforming it to uppercase characters.

Performs the same function as push except that the corresponding environment variable does not get the uppercase letters of name but instead name is pushed raw onto the corresponding environment variable.

Rewinds this ConfigKey back to the state it was at before the last push method being called.

Returns the corresponding environment variable key for this configuration value.

Returns an iterator of the key parts as strings.

Returns whether or not this is a key for the root table.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

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: 48 bytes