Trait ConfigRead

Source
pub trait ConfigRead {
    // Required methods
    fn into_config(self) -> Config;
    fn list<S: AsRef<str>>(
        &self,
        glob_pattern: S,
    ) -> Result<Vec<(String, String)>>;
    fn get<V: GetConfigValue<V>, S: AsRef<str>>(
        &self,
        key: S,
    ) -> Result<Option<V>>;

    // Provided methods
    fn get_or<V: GetConfigValue<V>, S: AsRef<str>>(
        &self,
        key: S,
        default: V,
    ) -> Result<V> { ... }
    fn get_or_else<V: GetConfigValue<V>, S: AsRef<str>, F: FnOnce() -> V>(
        &self,
        key: S,
        default: F,
    ) -> Result<V> { ... }
}
Expand description

Read-only interface to Git’s configuration.

Required Methods§

Source

fn into_config(self) -> Config

Convert this object into an owned, writable version of the configuration. You should only use this if you know that it’s safe to write to the underlying configuration file.

Source

fn list<S: AsRef<str>>(&self, glob_pattern: S) -> Result<Vec<(String, String)>>

Get all config key-value pairs matching a certain glob pattern.

Source

fn get<V: GetConfigValue<V>, S: AsRef<str>>(&self, key: S) -> Result<Option<V>>

Get a config key of one of various possible types.

Provided Methods§

Source

fn get_or<V: GetConfigValue<V>, S: AsRef<str>>( &self, key: S, default: V, ) -> Result<V>

Same as get, but uses a default value if the config key doesn’t exist.

Source

fn get_or_else<V: GetConfigValue<V>, S: AsRef<str>, F: FnOnce() -> V>( &self, key: S, default: F, ) -> Result<V>

Same as get, but computes a default value if the config key doesn’t exist.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§