#[non_exhaustive]pub enum ValueOrigin {
DefaultMissing,
Env(String),
Default,
DefaultIf {
selector: String,
when: Option<String>,
},
}Expand description
Where a value came from, when it did not come from the command line.
About the value, not the flag. --color typed bare with default_missing has a
token for the flag and none for the value, and that distinction is the whole question
a spec author is asking when they ask why --color came out always. Values that were
typed are attributed to the token that carried them instead — see TokenRole::Value.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
DefaultMissing
A flag that takes a value was given without one, so the declaration supplied it:
default_missing, or the empty tri-state a bare value_optional flag records.
One variant for both, because from argv’s side the same thing happened — the flag
was typed and the value was not.
Env(String)
An environment variable, named.
Named because a flag may list several — env, env_fallback and deprecated_env,
folded together by SpecFlag::env_names — and “it came from the environment” does
not say which declaration fired or which one to delete.
Default
A declared default, on the flag or on the flag’s argument.
Not two variants: the precedence between them is a spec-authoring oddity rather than
a fact about the value, and usage lint is the place to complain about declaring
both.
DefaultIf
A default_if whose condition matched, with the condition that decided it. The
selector alone is ambiguous — several conditions may name it with different when
values.
Trait Implementations§
Source§impl Clone for ValueOrigin
impl Clone for ValueOrigin
Source§fn clone(&self) -> ValueOrigin
fn clone(&self) -> ValueOrigin
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValueOrigin
impl Debug for ValueOrigin
impl Eq for ValueOrigin
Source§impl PartialEq for ValueOrigin
impl PartialEq for ValueOrigin
impl StructuralPartialEq for ValueOrigin
Auto Trait Implementations§
impl Freeze for ValueOrigin
impl RefUnwindSafe for ValueOrigin
impl Send for ValueOrigin
impl Sync for ValueOrigin
impl Unpin for ValueOrigin
impl UnsafeUnpin for ValueOrigin
impl UnwindSafe for ValueOrigin
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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