Struct gix_config::file::section::Body
source · pub struct Body<'event>(/* private fields */);
Expand description
A opaque type that represents a section body.
Implementations§
source§impl<'event> Body<'event>
impl<'event> Body<'event>
Access
sourcepub fn value(&self, value_name: impl AsRef<str>) -> Option<Cow<'_, BStr>>
pub fn value(&self, value_name: impl AsRef<str>) -> Option<Cow<'_, BStr>>
Retrieves the last matching value in a section with the given value name, if present.
Note that we consider values without separator =
non-existing, i.e. [core]\na
would not exist.
If that’s expected, Self::value_implicit() must be used instead.
sourcepub fn value_implicit(&self, value_name: &str) -> Option<Option<Cow<'_, BStr>>>
pub fn value_implicit(&self, value_name: &str) -> Option<Option<Cow<'_, BStr>>>
Retrieves the last matching value in a section with the given value name, if present, and indicates
an implicit value with Some(None)
, and a non-existing one as None
sourcepub fn values(&self, value_name: &str) -> Vec<Cow<'_, BStr>>
pub fn values(&self, value_name: &str) -> Vec<Cow<'_, BStr>>
Retrieves all values that have the provided value name. This may return an empty vec, which implies there were no values with the provided key.
sourcepub fn value_names(&self) -> impl Iterator<Item = &ValueName<'event>>
pub fn value_names(&self) -> impl Iterator<Item = &ValueName<'event>>
Returns an iterator visiting all value names in order.
sourcepub fn contains_value_name(&self, value_name: &str) -> bool
pub fn contains_value_name(&self, value_name: &str) -> bool
Returns true if the section contains the provided value name.
sourcepub fn num_values(&self) -> usize
pub fn num_values(&self) -> usize
Returns the number of values in the section.
sourcepub fn is_void(&self) -> bool
pub fn is_void(&self) -> bool
Returns if the section is empty.
Note that this may count whitespace, see num_values()
for
another way to determine semantic emptiness.
Trait Implementations§
source§impl<'event> IntoIterator for Body<'event>
impl<'event> IntoIterator for Body<'event>
source§impl<'event> Ord for Body<'event>
impl<'event> Ord for Body<'event>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<'event> PartialEq for Body<'event>
impl<'event> PartialEq for Body<'event>
source§impl<'event> PartialOrd for Body<'event>
impl<'event> PartialOrd for Body<'event>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl<'event> Eq for Body<'event>
impl<'event> StructuralPartialEq for Body<'event>
Auto Trait Implementations§
impl<'event> Freeze for Body<'event>
impl<'event> RefUnwindSafe for Body<'event>
impl<'event> Send for Body<'event>
impl<'event> Sync for Body<'event>
impl<'event> Unpin for Body<'event>
impl<'event> UnwindSafe for Body<'event>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)