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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more