[go: up one dir, main page]

Struct git2::ConfigEntries

source ·
pub struct ConfigEntries<'cfg> { /* private fields */ }
Expand description

An iterator over the ConfigEntry values of a Config structure.

Due to lifetime restrictions, ConfigEntries does not implement the standard Iterator trait. It provides a next function which only allows access to one entry at a time. for_each is available as a convenience function.

Example

// Example of how to collect all entries.
use git2::Config;

let config = Config::new()?;
let iter = config.entries(None)?;
let mut entries = Vec::new();
iter
    .for_each(|entry| {
        let name = entry.name().unwrap().to_string();
        let value = entry.value().unwrap_or("").to_string();
        entries.push((name, value))
    })?;
for entry in &entries {
    println!("{} = {}", entry.0, entry.1);
}

Implementations§

Advances the iterator and returns the next value.

Returns None when iteration is finished.

Calls the given closure for each remaining entry in the iterator.

Trait Implementations§

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.