pub enum EventRef<'a> {
Comment {
tag: u8,
text: &'a BStr,
},
SectionHeader {
name: &'a BStr,
separator: Option<&'a BStr>,
subsection_name: Option<&'a BStr>,
},
SectionValueName(&'a BStr),
Value(&'a BStr),
Newline(&'a BStr),
ValueNotDone(&'a BStr),
ValueDone(&'a BStr),
Whitespace(&'a BStr),
KeyValueSeparator,
}Expand description
A view of a syntactic event in a parsed representation.
Values in parsed events can be stored as spans into an owning backing buffer. This type exposes their resolved byte-string references.
Variants§
Comment
A comment with a comment tag and the comment itself.
SectionHeader
A section header with its name and optional subsection details.
Fields
SectionValueName(&'a BStr)
A name to a value in a section.
Value(&'a BStr)
A completed value.
Newline(&'a BStr)
One or more consecutive line endings.
Both \n and \r\n are accepted, including mixed runs. Multiple line endings, such as
\n\n, are merged into a single event whose byte string contains the entire run.
ValueNotDone(&'a BStr)
An incomplete continued value.
ValueDone(&'a BStr)
The final part of a continued value.
Whitespace(&'a BStr)
Insignificant whitespace.
KeyValueSeparator
A = separator between key and value.
Implementations§
Source§impl EventRef<'_>
impl EventRef<'_>
Sourcepub fn to_bstr_lossy(&self) -> &BStr
pub fn to_bstr_lossy(&self) -> &BStr
Turn ourselves into the text we represent, lossy.
Note that this mirrors Event::to_bstr_lossy_in().
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, reproducing this event mostly losslessly.
Quoted subsection names are the exception: EventRef::SectionHeader contains the decoded
subsection name, so this method escapes it again and may normalize its original escape
spelling. The resulting header has the same subsection name, but may not be byte-for-byte
identical to the parsed input.