gix_config::file

Struct 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<'lookup, 'event> MultiValueMut<'_, 'lookup, 'event>

source

pub fn get(&self) -> Result<Vec<Cow<'_, BStr>>, Error>

Returns the actual values.

source

pub fn len(&self) -> usize

Returns the amount of values within this multivar.

source

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.

source

pub fn set_string_at(&mut self, index: usize, value: impl AsRef<str>)

Sets the value at the given index.

§Safety

This will panic if the index is out of range.

source

pub fn set_at<'a>(&mut self, index: usize, value: impl Into<&'a BStr>)

Sets the value at the given index.

§Safety

This will panic if the index is out of range.

source

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.

source

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.

source

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.

source

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>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'borrow, 'lookup, 'event> PartialEq for MultiValueMut<'borrow, 'lookup, 'event>

source§

fn eq(&self, other: &MultiValueMut<'borrow, 'lookup, 'event>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'borrow, 'lookup, 'event> Eq for MultiValueMut<'borrow, 'lookup, 'event>

source§

impl<'borrow, 'lookup, 'event> StructuralPartialEq for MultiValueMut<'borrow, 'lookup, 'event>

Auto Trait Implementations§

§

impl<'borrow, 'lookup, 'event> Freeze for MultiValueMut<'borrow, 'lookup, 'event>

§

impl<'borrow, 'lookup, 'event> RefUnwindSafe for MultiValueMut<'borrow, 'lookup, 'event>

§

impl<'borrow, 'lookup, 'event> !Send for MultiValueMut<'borrow, 'lookup, 'event>

§

impl<'borrow, 'lookup, 'event> !Sync for MultiValueMut<'borrow, 'lookup, 'event>

§

impl<'borrow, 'lookup, 'event> Unpin for MultiValueMut<'borrow, 'lookup, 'event>

§

impl<'borrow, 'lookup, 'event> !UnwindSafe for MultiValueMut<'borrow, 'lookup, 'event>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.