pub struct SectionRef<'a> { /* private fields */ }Expand description
A section in a git-config file, like [core] or [remote "origin"], along with all of its keys.
This is a view into data owned by its File.
Implementations§
Source§impl<'file> SectionRef<'file>
Access
impl<'file> SectionRef<'file>
Access
Sourcepub fn id(&self) -> SectionId
pub fn id(&self) -> SectionId
Return the unique id of the section, for use with the *_by_id() family of methods
in gix_config::File.
Sourcepub fn to_bstring(&self) -> BString
pub fn to_bstring(&self) -> BString
Serialize this type into a BString for convenience.
Note that to_string() can also be used, but might not be lossless.
Sourcepub fn write_to(&self, out: &mut dyn Write) -> Result<()>
pub fn write_to(&self, out: &mut dyn Write) -> Result<()>
Stream ourselves to the given out, in order to reproduce this section mostly losslessly
as it was parsed.
Sourcepub fn meta(&self) -> &'file Metadata
pub fn meta(&self) -> &'file Metadata
Return additional information about this sections origin.
Sourcepub fn value(&self, value_name: impl AsRef<str>) -> Option<BString>
pub fn value(&self, value_name: impl AsRef<str>) -> Option<BString>
Retrieves the last matching value in this section with the given value name, if present.
Sourcepub fn value_implicit(&self, value_name: &str) -> Option<Option<BString>>
pub fn value_implicit(&self, value_name: &str) -> Option<Option<BString>>
Retrieves the last matching value in this section, including implicit values.
Sourcepub fn values(&self, value_name: &str) -> Vec<BString>
pub fn values(&self, value_name: &str) -> Vec<BString>
Retrieves all values that have the provided value name.
Sourcepub fn value_names(&self) -> impl Iterator<Item = String> + '_
pub fn value_names(&self) -> impl Iterator<Item = String> + '_
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.
Trait Implementations§
Source§impl<'a> Clone for SectionRef<'a>
impl<'a> Clone for SectionRef<'a>
Source§fn clone(&self) -> SectionRef<'a>
fn clone(&self) -> SectionRef<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more