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§
source§impl<'cfg> ConfigEntries<'cfg>
impl<'cfg> ConfigEntries<'cfg>
Trait Implementations§
Auto Trait Implementations§
impl<'cfg> Freeze for ConfigEntries<'cfg>
impl<'cfg> RefUnwindSafe for ConfigEntries<'cfg>
impl<'cfg> !Send for ConfigEntries<'cfg>
impl<'cfg> !Sync for ConfigEntries<'cfg>
impl<'cfg> Unpin for ConfigEntries<'cfg>
impl<'cfg> UnwindSafe for ConfigEntries<'cfg>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more