pub enum Definition {
Path(PathBuf),
Environment(String),
Cli(Option<PathBuf>),
}
Expand description
Location where a config value is defined.
Variants§
Path(PathBuf)
Defined in a .cargo/config
, includes the path to the file.
Environment(String)
Defined in an environment variable, includes the environment key.
Cli(Option<PathBuf>)
Passed in on the command line. A path is attached when the config value is a path to a config file.
Implementations§
source§impl Definition
impl Definition
sourcepub fn root<'a>(&'a self, config: &'a Config) -> &'a Path
pub fn root<'a>(&'a self, config: &'a Config) -> &'a Path
Root directory where this is defined.
If from a file, it is the directory above .cargo/config
.
CLI and env are the current working directory.
sourcepub fn is_higher_priority(&self, other: &Definition) -> bool
pub fn is_higher_priority(&self, other: &Definition) -> bool
Returns true if self is a higher priority to other.
CLI is preferred over environment, which is preferred over files.
Trait Implementations§
source§impl Clone for Definition
impl Clone for Definition
source§fn clone(&self) -> Definition
fn clone(&self) -> Definition
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Definition
impl Debug for Definition
source§impl<'de> Deserialize<'de> for Definition
impl<'de> Deserialize<'de> for Definition
source§fn deserialize<D>(deserializer: D) -> Result<Definition, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Definition, D::Error>where D: Deserializer<'de>,
source§impl Display for Definition
impl Display for Definition
source§impl Ord for Definition
impl Ord for Definition
source§fn cmp(&self, other: &Definition) -> Ordering
fn cmp(&self, other: &Definition) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<Definition> for Definition
impl PartialEq<Definition> for Definition
source§fn eq(&self, other: &Definition) -> bool
fn eq(&self, other: &Definition) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<Definition> for Definition
impl PartialOrd<Definition> for Definition
source§fn partial_cmp(&self, other: &Definition) -> Option<Ordering>
fn partial_cmp(&self, other: &Definition) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Definition
impl StructuralEq for Definition
Auto Trait Implementations§
impl RefUnwindSafe for Definition
impl Send for Definition
impl Sync for Definition
impl Unpin for Definition
impl UnwindSafe for Definition
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,
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: 32 bytes
Size for each variant:
Path
: 24 bytesEnvironment
: 24 bytesCli
: 24 bytes