Struct git_config::file::MutableMultiValue[][src]

pub struct MutableMultiValue<'borrow, 'lookup, 'event> { /* fields omitted */ }

An intermediate representation of a mutable multivar obtained from GitConfig.

This holds a mutable reference to the underlying data structure of GitConfig, and thus guarantees through Rust’s borrower checker that multiple mutable references to GitConfig cannot be owned at the same time.

Implementations

impl<'lookup, 'event> MutableMultiValue<'_, 'lookup, 'event>[src]

pub fn get(&self) -> Result<Vec<Cow<'_, [u8]>>, GitConfigError<'_>>[src]

Returns the actual values. This is computed each time this is called.

Errors

Returns an error if the lookup failed.

#[must_use]pub fn len(&self) -> usize[src]

Returns the size of values the multivar has.

#[must_use]pub fn is_empty(&self) -> bool[src]

Returns if the multivar has any values. This might occur if the value was deleted but not set with a new value.

pub fn set_string(&mut self, index: usize, input: String)[src]

Sets the value at the given index.

Safety

This will panic if the index is out of range.

pub fn set_bytes(&mut self, index: usize, input: Vec<u8>)[src]

Sets the value at the given index.

Safety

This will panic if the index is out of range.

pub fn set_value<'a: 'event>(&mut self, index: usize, input: Cow<'a, [u8]>)[src]

Sets the value at the given index.

Safety

This will panic if the index is out of range.

pub fn set_values<'a: 'event>(
    &mut self,
    input: impl Iterator<Item = Cow<'a, [u8]>>
)
[src]

Sets all values to the provided values. 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.

pub fn set_str_all(&mut self, input: &str)[src]

Sets all values in this multivar to the provided one by copying the input for all values.

pub fn set_owned_values_all(&mut self, input: &[u8])[src]

Sets all values in this multivar to the provided one by copying the input bytes for all values.

pub fn set_values_all<'a: 'event>(&mut self, input: &'a [u8])[src]

Sets all values in this multivar to the provided one without owning the provided input. Note that this requires input to last longer than GitConfig. Consider using Self::set_owned_values_all or Self::set_str_all unless you have a strict performance or memory need for a more ergonomic interface.

pub fn delete(&mut self, index: usize)[src]

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.

pub fn delete_all(&mut self)[src]

Removes all values. Does nothing when called multiple times in succession.

Trait Implementations

impl<'borrow, 'lookup, 'event> Debug for MutableMultiValue<'borrow, 'lookup, 'event>[src]

impl<'borrow, 'lookup, 'event> Eq for MutableMultiValue<'borrow, 'lookup, 'event>[src]

impl<'borrow, 'lookup, 'event> PartialEq<MutableMultiValue<'borrow, 'lookup, 'event>> for MutableMultiValue<'borrow, 'lookup, 'event>[src]

impl<'borrow, 'lookup, 'event> StructuralEq for MutableMultiValue<'borrow, 'lookup, 'event>[src]

impl<'borrow, 'lookup, 'event> StructuralPartialEq for MutableMultiValue<'borrow, 'lookup, 'event>[src]

Auto Trait Implementations

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

impl<'borrow, 'lookup, 'event> Send for MutableMultiValue<'borrow, 'lookup, 'event>

impl<'borrow, 'lookup, 'event> Sync for MutableMultiValue<'borrow, 'lookup, 'event>

impl<'borrow, 'lookup, 'event> Unpin for MutableMultiValue<'borrow, 'lookup, 'event> where
    'event: 'borrow, 

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.