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);
}