Struct git_config::parser::ParsedSectionHeader
source · [−]pub struct ParsedSectionHeader<'a> {
pub name: SectionHeaderName<'a>,
pub separator: Option<Cow<'a, str>>,
pub subsection_name: Option<Cow<'a, str>>,
}
Expand description
A parsed section header, containing a name and optionally a subsection name.
Note that section headers must be parsed as valid ASCII, and thus all valid
instances must also necessarily be valid UTF-8, which is why we use a
str
instead of [[u8]
].
Fields
name: SectionHeaderName<'a>
The name of the header.
separator: Option<Cow<'a, str>>
The separator used to determine if the section contains a subsection.
This is either a period .
or a string of whitespace. Note that
reconstruction of subsection format is dependent on this value. If this
is all whitespace, then the subsection name needs to be surrounded by
quotes to have perfect reconstruction.
subsection_name: Option<Cow<'a, str>>
The subsection name without quotes if any exist.
Implementations
sourceimpl ParsedSectionHeader<'_>
impl ParsedSectionHeader<'_>
sourcepub fn to_vec(&self) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn to_vec(&self) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Generates a byte representation of the value. This should be used when non-UTF-8 sequences are present or a UTF-8 representation can’t be guaranteed.
sourcepub fn to_owned(&self) -> ParsedSectionHeader<'static>
pub fn to_owned(&self) -> ParsedSectionHeader<'static>
Coerces into an owned instance. This differs from the standard clone
implementation as calling clone will not copy the borrowed variant,
while this method will. In other words:
Borrow type | .clone() | to_owned() |
---|---|---|
Borrowed | Borrowed | Owned |
Owned | Owned | Owned |
This can be most effectively seen by the differing lifetimes between the
two. This method guarantees a 'static
lifetime, while clone
does
not.
Trait Implementations
sourceimpl<'a> Clone for ParsedSectionHeader<'a>
impl<'a> Clone for ParsedSectionHeader<'a>
sourcefn clone(&self) -> ParsedSectionHeader<'a>
fn clone(&self) -> ParsedSectionHeader<'a>
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<'a> Debug for ParsedSectionHeader<'a>
impl<'a> Debug for ParsedSectionHeader<'a>
sourceimpl<'a> Default for ParsedSectionHeader<'a>
impl<'a> Default for ParsedSectionHeader<'a>
sourcefn default() -> ParsedSectionHeader<'a>
fn default() -> ParsedSectionHeader<'a>
Returns the “default value” for a type. Read more
sourceimpl Display for ParsedSectionHeader<'_>
impl Display for ParsedSectionHeader<'_>
sourceimpl From<&'_ ParsedSectionHeader<'_>> for Vec<u8>
impl From<&'_ ParsedSectionHeader<'_>> for Vec<u8>
sourcefn from(header: &ParsedSectionHeader<'_>) -> Self
fn from(header: &ParsedSectionHeader<'_>) -> Self
Converts to this type from the input type.
sourceimpl From<ParsedSectionHeader<'_>> for Vec<u8>
impl From<ParsedSectionHeader<'_>> for Vec<u8>
sourcefn from(header: ParsedSectionHeader<'_>) -> Self
fn from(header: ParsedSectionHeader<'_>) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<ParsedSectionHeader<'a>> for Event<'a>
impl<'a> From<ParsedSectionHeader<'a>> for Event<'a>
sourcefn from(header: ParsedSectionHeader<'_>) -> Event<'_>
fn from(header: ParsedSectionHeader<'_>) -> Event<'_>
Converts to this type from the input type.
sourceimpl<'a> Hash for ParsedSectionHeader<'a>
impl<'a> Hash for ParsedSectionHeader<'a>
sourceimpl<'a> Ord for ParsedSectionHeader<'a>
impl<'a> Ord for ParsedSectionHeader<'a>
sourceimpl<'a> PartialEq<ParsedSectionHeader<'a>> for ParsedSectionHeader<'a>
impl<'a> PartialEq<ParsedSectionHeader<'a>> for ParsedSectionHeader<'a>
sourcefn eq(&self, other: &ParsedSectionHeader<'a>) -> bool
fn eq(&self, other: &ParsedSectionHeader<'a>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ParsedSectionHeader<'a>) -> bool
fn ne(&self, other: &ParsedSectionHeader<'a>) -> bool
This method tests for !=
.
sourceimpl<'a> PartialOrd<ParsedSectionHeader<'a>> for ParsedSectionHeader<'a>
impl<'a> PartialOrd<ParsedSectionHeader<'a>> for ParsedSectionHeader<'a>
sourcefn partial_cmp(&self, other: &ParsedSectionHeader<'a>) -> Option<Ordering>
fn partial_cmp(&self, other: &ParsedSectionHeader<'a>) -> 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<'a> Eq for ParsedSectionHeader<'a>
impl<'a> StructuralEq for ParsedSectionHeader<'a>
impl<'a> StructuralPartialEq for ParsedSectionHeader<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for ParsedSectionHeader<'a>
impl<'a> Send for ParsedSectionHeader<'a>
impl<'a> Sync for ParsedSectionHeader<'a>
impl<'a> Unpin for ParsedSectionHeader<'a>
impl<'a> UnwindSafe for ParsedSectionHeader<'a>
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