Struct git_config::file::SectionBody[][src]

pub struct SectionBody<'event>(_);

A opaque type that represents a section body.

Implementations

impl<'event> SectionBody<'event>[src]

#[must_use]pub fn value(&self, key: &Key<'_>) -> Option<Cow<'event, [u8]>>[src]

Retrieves the last matching value in a section with the given key. Returns None if the key was not found.

pub fn value_as<T: TryFrom<Cow<'event, [u8]>>>(
    &self,
    key: &Key<'_>
) -> Result<T, GitConfigError<'event>>
[src]

Retrieves the last matching value in a section with the given key, and attempts to convert the value into the provided type.

Errors

Returns an error if the key was not found, or if the conversion failed.

#[must_use]pub fn values(&self, key: &Key<'_>) -> Vec<Cow<'event, [u8]>>[src]

Retrieves all values that have the provided key name. This may return an empty vec, which implies there was values with the provided key.

pub fn values_as<T: TryFrom<Cow<'event, [u8]>>>(
    &self,
    key: &Key<'_>
) -> Result<Vec<T>, GitConfigError<'event>>
[src]

Retrieves all values that have the provided key name. This may return an empty vec, which implies there was values with the provided key.

Errors

Returns an error if the conversion failed.

pub fn keys(&self) -> impl Iterator<Item = &Key<'event>>[src]

Returns an iterator visiting all keys in order.

#[must_use]pub fn contains_key(&self, key: &Key<'_>) -> bool[src]

Checks if the section contains the provided key.

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

Returns the number of entries in the section.

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

Returns if the section is empty.

Trait Implementations

impl<'event> Clone for SectionBody<'event>[src]

impl<'event> Debug for SectionBody<'event>[src]

impl<'event> Default for SectionBody<'event>[src]

impl<'event> Eq for SectionBody<'event>[src]

impl<'event> From<Vec<Event<'event>, Global>> for SectionBody<'event>[src]

impl<'event> Hash for SectionBody<'event>[src]

impl<'event> Ord for SectionBody<'event>[src]

impl<'event> PartialEq<SectionBody<'event>> for SectionBody<'event>[src]

impl<'event> PartialOrd<SectionBody<'event>> for SectionBody<'event>[src]

impl<'event> StructuralEq for SectionBody<'event>[src]

impl<'event> StructuralPartialEq for SectionBody<'event>[src]

Auto Trait Implementations

impl<'event> RefUnwindSafe for SectionBody<'event>

impl<'event> Send for SectionBody<'event>

impl<'event> Sync for SectionBody<'event>

impl<'event> Unpin for SectionBody<'event>

impl<'event> UnwindSafe for SectionBody<'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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.