pub struct Origin {
pub kind: SourceKind,
pub identifier: String,
pub trust: Trust,
}Expand description
The exact place a value came from.
Not just the kind: the identifier, because “from the environment” is not an answer a
user can act on and HK_JOBS is. This is what makes config explain worth having.
Fields§
§kind: SourceKind§identifier: StringThe environment variable’s name, the file’s path, the git key — whatever a user would have to go and edit.
trust: TrustHow much this place is trusted, which is what the scope check reads.
Implementations§
Source§impl Origin
impl Origin
Sourcepub fn new(kind: SourceKind, identifier: impl Into<String>) -> Self
pub fn new(kind: SourceKind, identifier: impl Into<String>) -> Self
An origin of the given kind.
The trust follows the kind: this invocation for the command line, the environment and
the built-ins, and Trust::Project for anything else — because a kind usage does not
recognize is one it cannot vouch for, and a check that has to be remembered by each new
layer is one a new layer will forget. Say otherwise with Origin::trusted_as.
Sourcepub fn trusted_as(self, trust: Trust) -> Self
pub fn trusted_as(self, trust: Trust) -> Self
The same origin, trusted as stated.
For a custom layer that knows where it read from: a git config in $HOME is the
user’s own, while one in the checkout is not.
Sourcepub fn file(identifier: impl Into<String>, scope: FileScope) -> Self
pub fn file(identifier: impl Into<String>, scope: FileScope) -> Self
An origin in a config file of the given class.
Sourcepub fn declared_default() -> Self
pub fn declared_default() -> Self
The declared default.
Named for what it is rather than spelled Default::default, because an Origin has
no sensible zero — every one of them names a real place.