pub struct ParseResult<'pr> { /* private fields */ }Expand description
The result of parsing a source string.
Implementations§
Source§impl<'pr> ParseResult<'pr>
impl<'pr> ParseResult<'pr>
Sourcepub fn frozen_string_literals(&self) -> bool
pub fn frozen_string_literals(&self) -> bool
Returns whether we found a frozen_string_literal magic comment with a true value.
Sourcepub fn as_slice(&self, location: &Location<'pr>) -> &'pr [u8] ⓘ
pub fn as_slice(&self, location: &Location<'pr>) -> &'pr [u8] ⓘ
Returns a slice of the source string that was parsed using the given slice range.
Sourcepub fn line_offsets(&self) -> &'pr [u32]
pub fn line_offsets(&self) -> &'pr [u32]
Returns a slice containing the offsets of the start of each line in the source string that was parsed.
Sourcepub fn errors(&self) -> Diagnostics<'_> ⓘ
pub fn errors(&self) -> Diagnostics<'_> ⓘ
Returns an iterator that can be used to iterate over the errors in the parse result.
Sourcepub fn warnings(&self) -> Diagnostics<'_> ⓘ
pub fn warnings(&self) -> Diagnostics<'_> ⓘ
Returns an iterator that can be used to iterate over the warnings in the parse result.
Sourcepub fn comments(&self) -> Comments<'_> ⓘ
pub fn comments(&self) -> Comments<'_> ⓘ
Returns an iterator that can be used to iterate over the comments in the parse result.
Sourcepub fn magic_comments(&self) -> MagicComments<'_> ⓘ
pub fn magic_comments(&self) -> MagicComments<'_> ⓘ
Returns an iterator that can be used to iterate over the magic comments in the parse result.
Sourcepub fn data_loc(&self) -> Option<Location<'_>>
pub fn data_loc(&self) -> Option<Location<'_>>
Returns an optional location of the END marker and the rest of the content of the file.
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Returns true if there were no errors during parsing and false if there were.
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Returns true if there were errors during parsing and false if there were not.