Struct git_config::file::MultiValueMut
source · pub struct MultiValueMut<'borrow, 'lookup, 'event> { /* private fields */ }
Expand description
An intermediate representation of a mutable multivar obtained from a File
.
Implementations§
source§impl<'borrow, 'lookup, 'event> MultiValueMut<'borrow, 'lookup, 'event>
impl<'borrow, 'lookup, 'event> MultiValueMut<'borrow, 'lookup, 'event>
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the multivar does not have any values. This might occur if the value was deleted but wasn’t yet set with a new value.
sourcepub fn set_string_at(&mut self, index: usize, value: impl AsRef<str>)
pub fn set_string_at(&mut self, index: usize, value: impl AsRef<str>)
sourcepub fn set_values<'a, Iter, Item>(&mut self, values: Iter)where
Iter: IntoIterator<Item = Item>,
Item: Into<&'a BStr>,
pub fn set_values<'a, Iter, Item>(&mut self, values: Iter)where
Iter: IntoIterator<Item = Item>,
Item: Into<&'a BStr>,
Sets all values to the provided ones. Note that this follows zip
logic: if the number of values in the input is less than the number of
values currently existing, then only the first n
values are modified.
If more values are provided than there currently are, then the
remaining values are ignored.
Examples found in repository?
522 523 524 525 526 527 528 529 530 531 532 533 534 535
pub fn set_existing_raw_multi_value<'a, Iter, Item>(
&mut self,
section_name: impl AsRef<str>,
subsection_name: Option<&BStr>,
key: impl AsRef<str>,
new_values: Iter,
) -> Result<(), lookup::existing::Error>
where
Iter: IntoIterator<Item = Item>,
Item: Into<&'a BStr>,
{
self.raw_values_mut(section_name, subsection_name, key.as_ref())
.map(|mut v| v.set_values(new_values))
}
sourcepub fn set_all<'a>(&mut self, input: impl Into<&'a BStr>)
pub fn set_all<'a>(&mut self, input: impl Into<&'a BStr>)
Sets all values in this multivar to the provided one without owning the provided input.
sourcepub fn delete(&mut self, index: usize)
pub fn delete(&mut self, index: usize)
Removes the value at the given index. Does nothing when called multiple times in succession.
Safety
This will panic if the index is out of range.
sourcepub fn delete_all(&mut self)
pub fn delete_all(&mut self)
Removes all values. Does nothing when called multiple times in succession.
Trait Implementations§
source§impl<'borrow, 'lookup, 'event> Debug for MultiValueMut<'borrow, 'lookup, 'event>
impl<'borrow, 'lookup, 'event> Debug for MultiValueMut<'borrow, 'lookup, 'event>
source§impl<'borrow, 'lookup, 'event> PartialEq<MultiValueMut<'borrow, 'lookup, 'event>> for MultiValueMut<'borrow, 'lookup, 'event>
impl<'borrow, 'lookup, 'event> PartialEq<MultiValueMut<'borrow, 'lookup, 'event>> for MultiValueMut<'borrow, 'lookup, 'event>
source§fn eq(&self, other: &MultiValueMut<'borrow, 'lookup, 'event>) -> bool
fn eq(&self, other: &MultiValueMut<'borrow, 'lookup, 'event>) -> bool
self
and other
values to be equal, and is used
by ==
.