pub(crate) struct Header<'a>(&'a str);Expand description
The desired header text of a document.
The header of a document is the comment block at the very top that is followed by at least one blank line. A comment block directly above the first entry belongs to that entry.
Tuple Fields§
§0: &'a strImplementations§
Source§impl<'a> Header<'a>
impl<'a> Header<'a>
Sourcepub(crate) fn block(self) -> String
pub(crate) fn block(self) -> String
The header followed by one blank line, or an empty string when there is no header.
Sourcepub(crate) fn applied_to(
self,
current: &str,
existing: Existing,
) -> Option<Applied<'_>>
pub(crate) fn applied_to( self, current: &str, existing: Existing, ) -> Option<Applied<'_>>
The leading text current becomes: its header block replaced by this
header, or this header put in front when it has none or the block is
kept. None when
there is no header or nothing changes.
Sourcepub(crate) fn applied_to_parts<'c>(
self,
root: &str,
first: &'c str,
existing: Existing,
) -> Option<Applied<'c>>
pub(crate) fn applied_to_parts<'c>( self, root: &str, first: &'c str, existing: Existing, ) -> Option<Applied<'c>>
Like applied_to for the text first that follows root, without
joining the two when root is empty.
Sourcefn changed_from(self, current: &str, existing: Existing) -> Option<usize>
fn changed_from(self, current: &str, existing: Existing) -> Option<usize>
Where the text after the old header block starts in current, or
None when there is no header or current already starts with it.
A document that holds only the header counts, with or without a blank
line after it.
Sourcefn block_len(text: &str) -> usize
fn block_len(text: &str) -> usize
The length of the header block at the start of text, including the
blank lines after it. Zero when the top block has no blank line after
it.