Struct git_config::file::SectionBody
source · [−]pub struct SectionBody<'event>(_);
Expand description
A opaque type that represents a section body.
Implementations
sourceimpl<'event> SectionBody<'event>
impl<'event> SectionBody<'event>
sourcepub fn value(&self, key: &Key<'_>) -> Option<Cow<'event, [u8]>>
pub fn value(&self, key: &Key<'_>) -> Option<Cow<'event, [u8]>>
Retrieves the last matching value in a section with the given key. Returns None if the key was not found.
sourcepub fn value_as<T: TryFrom<Cow<'event, [u8]>>>(
&self,
key: &Key<'_>
) -> Result<T, Error<T::Error>>
pub fn value_as<T: TryFrom<Cow<'event, [u8]>>>(
&self,
key: &Key<'_>
) -> Result<T, Error<T::Error>>
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.
sourcepub fn values(&self, key: &Key<'_>) -> Vec<Cow<'event, [u8]>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn values(&self, key: &Key<'_>) -> Vec<Cow<'event, [u8]>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Retrieves all values that have the provided key name. This may return an empty vec, which implies there were no values with the provided key.
sourcepub fn values_as<T: TryFrom<Cow<'event, [u8]>>>(
&self,
key: &Key<'_>
) -> Result<Vec<T>, Error<T::Error>>
pub fn values_as<T: TryFrom<Cow<'event, [u8]>>>(
&self,
key: &Key<'_>
) -> Result<Vec<T>, Error<T::Error>>
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.
sourcepub fn keys(&self) -> impl Iterator<Item = &Key<'event>>
pub fn keys(&self) -> impl Iterator<Item = &Key<'event>>
Returns an iterator visiting all keys in order.
sourcepub fn contains_key(&self, key: &Key<'_>) -> bool
pub fn contains_key(&self, key: &Key<'_>) -> bool
Checks if the section contains the provided key.
Trait Implementations
sourceimpl<'event> Clone for SectionBody<'event>
impl<'event> Clone for SectionBody<'event>
sourcefn clone(&self) -> SectionBody<'event>
fn clone(&self) -> SectionBody<'event>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'event> Debug for SectionBody<'event>
impl<'event> Debug for SectionBody<'event>
sourceimpl<'event> Default for SectionBody<'event>
impl<'event> Default for SectionBody<'event>
sourcefn default() -> SectionBody<'event>
fn default() -> SectionBody<'event>
Returns the “default value” for a type. Read more
sourceimpl<'event> Hash for SectionBody<'event>
impl<'event> Hash for SectionBody<'event>
sourceimpl<'event> IntoIterator for SectionBody<'event>
impl<'event> IntoIterator for SectionBody<'event>
sourceimpl<'event> Ord for SectionBody<'event>
impl<'event> Ord for SectionBody<'event>
sourceimpl<'event> PartialEq<SectionBody<'event>> for SectionBody<'event>
impl<'event> PartialEq<SectionBody<'event>> for SectionBody<'event>
sourcefn eq(&self, other: &SectionBody<'event>) -> bool
fn eq(&self, other: &SectionBody<'event>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SectionBody<'event>) -> bool
fn ne(&self, other: &SectionBody<'event>) -> bool
This method tests for !=
.
sourceimpl<'event> PartialOrd<SectionBody<'event>> for SectionBody<'event>
impl<'event> PartialOrd<SectionBody<'event>> for SectionBody<'event>
sourcefn partial_cmp(&self, other: &SectionBody<'event>) -> Option<Ordering>
fn partial_cmp(&self, other: &SectionBody<'event>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<'event> Eq for SectionBody<'event>
impl<'event> StructuralEq for SectionBody<'event>
impl<'event> StructuralPartialEq for SectionBody<'event>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more