pub trait AsKey {
// Required methods
fn as_key(&self) -> KeyRef<'_>;
fn try_as_key(&self) -> Option<KeyRef<'_>>;
}
Expand description
Parse parts of a Git configuration key, like remote.origin.url
or core.bare
.
Required Methods§
Sourcefn as_key(&self) -> KeyRef<'_>
fn as_key(&self) -> KeyRef<'_>
Return a parsed key reference, containing all relevant parts of a key.
For instance, remote.origin.url
such key would yield access to ("remote", Some("origin"), "url")
while user.name
would yield ("user", None, "name")
.
§Panic
If there is no valid KeyRef
representation.
Sourcefn try_as_key(&self) -> Option<KeyRef<'_>>
fn try_as_key(&self) -> Option<KeyRef<'_>>
Return a parsed key reference, containing all relevant parts of a key.
For instance, remote.origin.url
such key would yield access to ("remote", Some("origin"), "url")
while user.name
would yield ("user", None, "name")
.