gix_config

Trait 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<'_>