Trait gix_config::AsKey

source ·
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§

source

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.

source

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").

Implementations on Foreign Types§

source§

impl AsKey for &str

source§

fn as_key(&self) -> KeyRef<'_>

source§

fn try_as_key(&self) -> Option<KeyRef<'_>>

source§

impl AsKey for &BStr

source§

fn as_key(&self) -> KeyRef<'_>

source§

fn try_as_key(&self) -> Option<KeyRef<'_>>

source§

impl AsKey for String

source§

fn as_key(&self) -> KeyRef<'_>

source§

fn try_as_key(&self) -> Option<KeyRef<'_>>

source§

impl AsKey for BString

source§

fn as_key(&self) -> KeyRef<'_>

source§

fn try_as_key(&self) -> Option<KeyRef<'_>>

source§

impl<T> AsKey for &T
where T: AsKey,

source§

fn as_key(&self) -> KeyRef<'_>

source§

fn try_as_key(&self) -> Option<KeyRef<'_>>

Implementors§

source§

impl AsKey for KeyRef<'_>